note 83071 deleted from ref.mcrypt by danbrown

From: Date: Mon, 13 Dec 2010 16:21:25 +0000
Subject: note 83071 deleted from ref.mcrypt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174851@lists.php.net to get a copy of this message
Note Submitter: EllisGL ---- mre's aes_128_decrypt function was outputting trash at the end. here's my fix. function aes_128_decrypt($encrypted_text,$password) { $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM); preg_match('/([\x20-\x7E]*)/',mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", $encrypted_text), MCRYPT_MODE_ECB, $iv), $a); return $a[0]; } // End of function

« previous php.notes (#174851) next »