note 105985 added to function.mcrypt-decrypt
| From: | beltrachi at osu1 dot php dot net | Date: | Fri, 30 Sep 2011 07:34:06 +0000 |
| Subject: | note 105985 added to function.mcrypt-decrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183536@lists.php.net to get a copy of this message | ||
Caution, MCRYPT_RIJNDAEL_256 is not equivalent to AES_256.
The way to make RIJNDAEL be decrypted from AES with openssl is to use MCRYPT_RIJNDAEL_128 and padd
the string to encrypt before encrypting with the follwing function:
function pkcs5_pad ($text, $blocksize) {
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
On the decryption, the choosing of AES_256 or AES_128, etc. is based on the keysize used in the
crypting. In my case it was a 128bit key so I used AES_128.
----
Server IP: 69.147.83.197
Probable Submitter: 213.151.106.134
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-decrypt.php
Edit -- https://master.php.net/note/edit/105985
Del: integrated -- https://master.php.net/note/delete/105985/integrated
Del: useless -- https://master.php.net/note/delete/105985/useless
Del: bad code -- https://master.php.net/note/delete/105985/bad+code
Del: spam -- https://master.php.net/note/delete/105985/spam
Del: non-english -- https://master.php.net/note/delete/105985/non-english
Del: in docs -- https://master.php.net/note/delete/105985/in+docs
Del: other reasons-- https://master.php.net/note/delete/105985
Reject -- https://master.php.net/note/reject/105985
Search -- https://master.php.net/manage/user-notes.php