Reputation: 1609
I would like to use a salt that has more than 24 characters with mcrypt.
mcrypt_encrypt(MCRYPT_RIJNDAEL_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?
Upvotes: 4
Views: 5258
Reputation: 1615
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
Upvotes: 3
Reputation: 169
I would personally MD5 the salt and use that otherwise you need to select a different algorithm.
Upvotes: 0