RE: [PHP-DB] HELP! ENCRYPTION
| From: | Troy Settle | Date: | Tue, 10 Oct 2000 14:10:58 +0000 |
| Subject: | RE: [PHP-DB] HELP! ENCRYPTION | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3473@lists.php.net to get a copy of this message | ||
I don't know anything about the mcrypt stuff yet, but it sounds like you're
not retrieving the same data that you're storing. A sample of the code that
you're using to store/retrieve the information from the database would be
helpful.
--
Troy Settle
Pulaski Networks
540.994.4254
It's always a long day, 86400 doesn't fit into a short
> -----Original Message-----
> From: The Shadow [mailto:dibya@radioclick.com]
> Sent: Tuesday, October 10, 2000 9:15 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] HELP! ENCRYPTION
>
>
> i try to encrypt some string then decrypt it
> the decryption proces works only when the ecrypted string NOT stored in
> mysql...(blob type)..
> when the encrypted string stored to mysql using mysql_db_query, then
> retrieve it again and fetch it to an array using mysql_fetch_array then
> decrypt it , the result is the data before encryption is
> different from data
> after decryption...
>
> why?
>
>
> below is my code:
> -------WORKED VERSION---------------
> $iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_BLOWFISH,
> MCRYPT_MODE_CBC), MCRYPT_RAND);
> $key = "secret key";
>
> $text = "Meet me at 11 o'clock behind the monument.";
>
> $crypttext = mcrypt_encrypt (MCRYPT_BLOWFISH, $key, $text,
> MCRYPT_MODE_CBC,
> $iv);
>
> $descrypttext = mcrypt_decrypt (MCRYPT_BLOWFISH, $key, $crypttext,
> MCRYPT_MODE_CBC, $iv);
>
> -----------WORKED VERSION EOF-------------------------
>
> result is $descrypttext = $text
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>