note 78764 added to ref.mcrypt

From: Date: Fri, 26 Oct 2007 13:25:18 +0000
Subject: note 78764 added to ref.mcrypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-131748@lists.php.net to get a copy of this message
Here are my functions to do a 128 bit aes encryption which is transmitted to the dachser parcel tracking system via url. They expect a true aes 128 bit encryption an process the reqest by a java script. The decrypt function is just a giveaway. function aes_128_encrypt($text,$password) { $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM); // The following line was needed because I didn't get the same hex value as expected by forwarding agency // I think its their bug // Try to remove the line. If it works, too - fine! $text .= chr(3).chr(3).chr(3); return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $password, $text, MCRYPT_MODE_ECB, $iv)); } // End of function 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); return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", $encrypted_text), MCRYPT_MODE_ECB, $iv); } // End of function ---- Server IP: 217.160.72.57 Probable Submitter: 87.139.48.204 ---- Manual Page -- http://www.php.net/manual/en/ref.mcrypt.php Edit -- https://master.php.net/note/edit/78764 Del: integrated -- https://master.php.net/note/delete/78764/integrated Del: useless -- https://master.php.net/note/delete/78764/useless Del: bad code -- https://master.php.net/note/delete/78764/bad+code Del: spam -- https://master.php.net/note/delete/78764/spam Del: non-english -- https://master.php.net/note/delete/78764/non-english Del: in docs -- https://master.php.net/note/delete/78764/in+docs Del: other reasons-- https://master.php.net/note/delete/78764 Reject -- https://master.php.net/note/reject/78764 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131748) next »