0

I was searching for twofish encryption then I found mcrypt and they said I should use the cipher: MCRYPT_TWOFISH256 (because I want 256 bit key size) But it didnt work and I checked my version and the version to use MCRYPT_TWOFISH256.

THIS maked me confusing: In the mcrypt documentary is said that I needed an OLDER version too use MCRYPT_TWOFISHxxx and the newer version used only MCRYPT_TWOFISH and NO numbers after it that tells the key size so my question:

How big is the key size for the cipher: MCRYPT_TWOFISH. Because it dosnt have any numbers in the end that tells the key size. Example: MCRYPT_SERPENT_256

4

1 回答 1

0

对于 MCRYPT_TWOFISH,密钥大小为 256 位。

来自http://php.net/manual/en/mcrypt.ciphers.php#101462

mcrypt 2.4.x 及更高版本定义的 MCRYPT_TWOFISH 常量是 Twofish 的 256 位版本;它使用 1-32 字节的密钥、16 字节的 IV,并以 CBC 模式输出 16 字节的块。

快速浏览一下 PHP 和 mcrypt 源代码似乎支持这种说法。特别是http://mcrypt.cvs.sourceforge.net/viewvc/mcrypt/libmcrypt-nm/lib/mcrypt_extra.c?view=markup#l60MCRYPT_ENTRY(MCRYPT_TWOFISH, 16, 32, 1)其中 32 是密钥大小(以字节为单位)。

于 2014-12-31T13:37:19.040 回答