note 43938 added to function.mcrypt-decrypt
| From: | kooktroop at gmail dot com | Date: | Fri, 09 Jul 2004 07:13:37 +0000 |
| Subject: | note 43938 added to function.mcrypt-decrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72913@lists.php.net to get a copy of this message | ||
Following on from the mcrypt_encrypt() example:
<?php
$text = "boggles the inivisble monkey will rule the world";
$key = "This is a very secret key";
$iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
echo strlen($text) . "<br>";
$enc = mcrypt_encrypt(MCRYPT_XTEA, $key, $text, MCRYPT_MODE_ECB, $iv);
echo strlen($enc) . "<br>";
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "This is a very secret key";
$text = "Meet me at 11 o'clock behind the monument.";
echo strlen($text) . "<br>";
$crypttext = mcrypt_decrypt(MCRYPT_XTEA, $key, $enc, MCRYPT_MODE_ECB, $iv);
echo "$crypttext<br>";
?>
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-decrypt.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43938
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43938&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43938&report=yes
Search -- http://master.php.net/manage/user-notes.php