encryption - PHP CAST-256 mcrypt output differs -
encryption - PHP CAST-256 mcrypt output differs -
i attempting encrypt string using cast256 , cbc, via php function mcrypt_encrypt
. using key test
input test
, produces next code:
mcrypt_encrypt(mcrypt_cast_256, 'test', 'test', mcrypt_mode_cbc);
the base64 encoded version of produces (on php version 5.5.12):
daypocfvfoi8ghemj0zkeg==
however, comparing output against tool on http://www.tools4noobs.com/online_tools/encrypt/, , output differs significantly; site output using aforementioned cipher, mode, key, , info following:
eiknqgahjsgh+11xzsa2lg==
decrypting each string using opposite tool (i.e. site output decrypted php, , php output decrypted via site) gives next output:
ducd000000000000 (site output) ducd000000000000 (php output)
however, decrypting using same medium string encrypted gives input info ('test').
my question is, is there reason difference, such omission of iv when encrypting/decrypting or misuse of php mcrypt_decrypt function?
this bug in libmcrypt's cast-256 module, , site you've linked seems affected it.
i same output on local machine , rfc2612 test vectors pass on mine, don't worry - it's not error on part, nor broken on end.
i have should never encrypt without using iv , proper encryption key ('test' not proper key). should utilize more proven algorithm aes.
php encryption cryptography mcrypt
Comments
Post a Comment