// ECB mode encryption
 private int EcbEncrypt(byte[] input, int inputOffset, int inputCount, byte[] output, int outputOffset)
 {
     if (inputCount < cipherBytes)
     {
         return(0);
     }
     GetBytes(input, inputOffset, block, cipherBytes);
     cipher.Encrypt(block, block);
     PutBytes(block, output, outputOffset, cipherBytes);
     return(cipherBytes);
 }
Beispiel #2
0
 private void ProcessBlock(int bytes)
 {
     // Set the key to the current state
     cipher.SetKey(state);
     // Update tweak
     UbiParameters.BitsProcessed += (ulong)bytes;
     cipher.SetTweak(UbiParameters.Tweak);
     // Encrypt block
     cipher.Encrypt(cipherInput, state);
     // Feed-forward input with state
     for (int i = 0; i < cipherInput.Length; i++)
     {
         state[i] ^= cipherInput[i];
     }
 }