how long is the default key size used by mcrypt_blowfish?

别等时光非礼了梦想. 提交于 2019-12-08 14:08:57

问题


I'm going to use Blowfish cipher for my project in PHP (mcrypt_blowfish). But I have a question regarding the used of mcrypt_blowfish, how long is the deafult key size that was used by this mode of encryption in PHP?? Some other cipher that was support by libmcrypt had a declared key size, like :

 MCRYPT_RIJNDAEL_128 --> 128 bit key

 MCRYPT_RIJNDAEL_192 --> 192 bit key

 MCRYPT_RC6_128 --> 128 bit key

 MCRYPT_RC6_192 --> 192 bit key

But how long is the deafult key size for mcrypt_blowfish?? Thx before...


回答1:


It seems to use a variable key size (it seems there isn't a "default" size) :

http://en.wikipedia.org/wiki/Blowfish_(cipher)

"Blowfish has a 64-bit block size and a variable key length from 32 bits up to 448 bits"

Here is an example using a 448 bits key : http://www.php.net/manual/en/function.mcrypt-encrypt.php#96635

Looking on other sites, MCRYPT_BLOWFISH_128, MCRYPT_BLOWFISH_192, MCRYPT_BLOWFISH_256 and MCRYPT_BLOWFISH_448 should work too (didn't try ^^)



来源:https://stackoverflow.com/questions/16331928/how-long-is-the-default-key-size-used-by-mcrypt-blowfish

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!