HELP! ENCRYPTION

From: Date: Tue, 10 Oct 2000 13:15:10 +0000
Subject: HELP! ENCRYPTION
Groups: php.db 
Request: Send a blank email to php-db+get-3472@lists.php.net to get a copy of this message
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

« previous php.db (#3472) next »