Mcrypt Function - New to it
| From: | Tom Ray | Date: | Fri, 31 May 2002 03:07:45 +0000 |
| Subject: | Mcrypt Function - New to it | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100044@lists.php.net to get a copy of this message | ||
Hi there..some what a new programmer when it comes to all this. I'm trying to encrypt some data and then decrypt it. It doesn't have to be high bit encryption just something simple like 3DES. But I keep getting it wrong. Any help would be greatful. Here's the piece of code:
$iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_3DES,
MCRYPT_MODE_ECB), MCRYPT_RAND);$key = md5("Secret Key"); $sample2 = "Hello"; $lockdata = mcrypt_encrypt (MCRYPT_3DES, $key, $sample2,
MCRYPT_MODE_ECB, $iv);echo "$lockdata\n"; $text = mcrypt_decrypt (MCRYPT_3DES, $key, $lockdata, MCRPYT_MODE_ECB,
$iv);echo "$text\n";