note 82657 added to ref.mcrypt
| From: | matrix dot epokh at gmail dot com | Date: | Mon, 21 Apr 2008 05:21:57 +0000 |
| Subject: | note 82657 added to ref.mcrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138593@lists.php.net to get a copy of this message | ||
Using the decrypt funciont of the Pear class Crypt_Blowfish, the decrypted text must be cleaned from
null characters (this happen when the text size is not a multiple of the cbc block size). So the
correct code should be like:
11 $plaintext = $bf->decrypt($encrypted);
12 if (PEAR::isError($plaintext)) {
13 echo $plaintext->getMessage();
14 exit;
15 }
16 // Encrypted text is padded prior to encryption
17 // so you may need to trim the decrypted result.
18 echo 'plain text: ' . trim($plaintext,"\0");
----
Server IP: 87.124.64.96
Probable Submitter: 58.40.105.129
----
Manual Page -- http://www.php.net/manual/en/ref.mcrypt.php
Edit -- https://master.php.net/note/edit/82657
Del: integrated -- https://master.php.net/note/delete/82657/integrated
Del: useless -- https://master.php.net/note/delete/82657/useless
Del: bad code -- https://master.php.net/note/delete/82657/bad+code
Del: spam -- https://master.php.net/note/delete/82657/spam
Del: non-english -- https://master.php.net/note/delete/82657/non-english
Del: in docs -- https://master.php.net/note/delete/82657/in+docs
Del: other reasons-- https://master.php.net/note/delete/82657
Reject -- https://master.php.net/note/reject/82657
Search -- https://master.php.net/manage/user-notes.php