/// <summary>
 /// Gets the total number of padding bytes that will be needed.
 /// </summary>
 /// <param name="lastBlockBytesUsed">The total number of bytes that are used by real data in the last block.</param>
 /// <param name="blockSizeInBytes">The block cipher size.</param>
 /// <returns>The total number of padding bytes that will be needed.</returns>
 protected virtual int InternalGetFinalPaddingCount(int lastBlockBytesUsed, int blockSizeInBytes)
 {
     return(PaddingUtilities.GetPaddingBytesNeeded(_PaddingMode, lastBlockBytesUsed, blockSizeInBytes));
 }
Exemplo n.º 2
0
 protected override byte[] InternalTransformFinalBlock(byte[] input, int blockSizeInBytes)
 {
     return(PaddingUtilities.RemovePadding(_PaddingMode, InternalTransformBlock(input)));
 }
 /// <summary>
 /// Transforms the last block of data.
 /// </summary>
 /// <param name="input">The block to transform.</param>
 /// <param name="blockSizeInBytes">The expected block size.</param>
 /// <returns>The result (possibly padded as needed).</returns>
 protected virtual byte[] InternalTransformFinalBlock(byte[] input, int blockSizeInBytes)
 {
     byte[] paddedInput = PaddingUtilities.ApplyPadding(_PaddingMode, input, blockSizeInBytes);
     byte[] lastBlock   = InternalTransformBlock(paddedInput);
     return(lastBlock);
 }