why does (C#)
System.Security.Cryptography.TripleDESCryptoServiceProvider.BlockSize
and (PHP)
mcrypt_get_block_size(MCRYPT_TIPRLEDES, MCRYPT_MODE_ECB);
returns a different result?
The C# System.Security.Cryptography.TripleDESCryptoServiceProvider.BlockSize value is in bits , while PHP's mcrypt_get_block_size() returns it in bytes .
1 byte = 8 bits; 64 / 8 = 8 bytes
It's the same value, just represented in different measurement units.
Encryption key sizes and block sizes are not related.
DES and thus Triple DES have a block size of 8-bytes.
Triple DES has a key size of 168-bits in 24-bytes. There are schemes to use shorter keys such as 16-bytes and duplicate the first 8-bytes to the last 8-bytes, this sometimes called Two Key Triple DES.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.