I would like to use a salt that has more than 24 characters with mcrypt.
mcrypt_encrypt(MCRYPT_RIJNDA开发者_如何学JAVAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND));
However if I make $salt greater than 24 characters it throws this warning and uses a truncated salt at 24 characters:
Warning: mcrypt_encrypt() [function.mcrypt-encrypt]: Size of key is too large for this algorithm
Is there any way to get around this?
24 is the limit of this alorithm. Chars over 24 characters isn't used. But you can always trasnform your salt.
http://en.wikipedia.org/wiki/Advanced_Encryption_Standard
I would personally MD5 the salt and use that otherwise you need to select a different algorithm.
精彩评论