note 47887 deleted from function.mcrypt-encrypt by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 10:13:04 +0000 |
| Subject: | note 47887 deleted from function.mcrypt-encrypt by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196901@lists.php.net to get a copy of this message | ||
Note Submitter: cleong at nflc dot org
----
Note that the key need to be a binary string--not a hex string. A 128-bit key would be 16 characters
long, for example.
Use the pack() function to quickly convert a hex string into the actual binary data:
<?php
$key_hex = '66e94bd4ef8a2c3b884cfa59ca342b2e';
$key_bin = pack('H*', $key_hex);
$pt = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key_bin, $et, MCRYPT_MODE_ECB);
?>