note 86089 added to function.mcrypt-decrypt
| From: | david at sickmiller dot com | Date: | Thu, 02 Oct 2008 17:15:29 +0000 |
| Subject: | note 86089 added to function.mcrypt-decrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144990@lists.php.net to get a copy of this message | ||
If you happen to be decrypting something encrypted in ColdFusion, you'll discover that its
encrypt function apparently pads the plaintext with ASCII 4, the "end of transmission"
character.
Building on eddiec's code, you can remove both nulls and EOTs with this:
<?php
$retval = mcrypt_decrypt( ...etc ...);
$retval = rtrim($retval, "\0\4"); // trim ONLY the nulls and EOTs at the END
?>
----
Server IP: 208.69.120.35
Probable Submitter: 67.167.138.237
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-decrypt.php
Edit -- https://master.php.net/note/edit/86089
Del: integrated -- https://master.php.net/note/delete/86089/integrated
Del: useless -- https://master.php.net/note/delete/86089/useless
Del: bad code -- https://master.php.net/note/delete/86089/bad+code
Del: spam -- https://master.php.net/note/delete/86089/spam
Del: non-english -- https://master.php.net/note/delete/86089/non-english
Del: in docs -- https://master.php.net/note/delete/86089/in+docs
Del: other reasons-- https://master.php.net/note/delete/86089
Reject -- https://master.php.net/note/reject/86089
Search -- https://master.php.net/manage/user-notes.php