示例#1
0
 public void Run( SaveBlock buffer, int offset, int length )
 {
     for( int i = offset; i < offset + length; i += 2 )
     {
         //test this little endian conversion
         var bitmask = Next();
         buffer[i] = (byte) ( buffer[i] ^ ( ( ( bitmask & 0xff00 ) >> 8 ) ) );
         buffer[i + 1] = (byte) ( buffer[i + 1] ^ ( bitmask & 0xff ) );
     }
 }
示例#2
0
 public static void BlocksForEncryption( SaveBlock _buffer, uint Personality )
 {
     ShuffleBlocks( _buffer, Personality, toencrypt );
 }
示例#3
0
        static void ShuffleBlocks( SaveBlock _buffer, uint Personality, int[] indexes )
        {
            var blocks = new byte[4][];
            for( int i = 0; i < 4; i++ )
            {
                blocks[i] = new byte[32];
                for( int j = 0; j < 32; j++ )
                {
                    blocks[i][j] = _buffer[i * 32 + j];
                }
            }

            for( int i = 0; i < 4; i++ )
            {
                var toindex = ExtractShuffleIndexFromArray( i, Personality, indexes );
                for( int j = 0; j < 32; j++ )
                {
                    _buffer[toindex * 32 + j] = blocks[i][j];
                }
            }
        }
示例#4
0
 public NdsPkm( SaveBlock buffer, bool fromPkm )
 {
     _buffer = buffer;
     EncryptionState = fromPkm ? PkmState.Decrypted : PkmState.Encrypted;
 }