note 86089 added to function.mcrypt-decrypt

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.