Exemplo n.º 1
0
 void Encrypt()
 {
     var checksum = GenerateChecksum();
     if( !checksum.HasValue )
         throw new Exception( "Couldnt generate checksum from encrypted block" );
     Checksum = checksum.Value;
     Shuffle.BlocksForEncryption( _buffer, Personality );
     var pkmDataEncryption = new EncryptionSequence( checksum.Value );
     pkmDataEncryption.Run( _buffer, 8, 128 );
     if( !_isStorage )
     {
         var battleDataEncryption = new EncryptionSequence( Personality );
         battleDataEncryption.Run( _buffer, 136, 100 );
     }
 }
Exemplo n.º 2
0
 void Decrypt()
 {
     var pkmDataEncryption = new EncryptionSequence( Checksum );
     pkmDataEncryption.Run( _buffer, 8, 128 );
     if( !_isStorage )
     {
         var battleDataEncryption = new EncryptionSequence( Personality );
         battleDataEncryption.Run( _buffer, 136, 100 );
     }
     Shuffle.BlocksForDecryption( _buffer, Personality );
 }