note 113625 added to function.mdecrypt-generic
| From: | Ulysse | Date: | Thu, 07 Nov 2013 14:27:10 +0000 |
| Subject: | note 113625 added to function.mdecrypt-generic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197451@lists.php.net to get a copy of this message | ||
Based on the information provided by "jakub dot lopuszanski at nasza-klasa dot pl" that in
PKCS#7, the last byte contains the number of byte to remove (see RFC 5652, part 6.3), and for those
like me who like to copy paste an already-made snippet:
<?php
function unpadPKCS7($data, $blocksize)
{
$last = substr($data, -1);
return substr($data, 0, strlen($data) - ord($last));
}
?>
Now you have no more reason to use rtrim() to remove the padding at the end of the result.
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.mdecrypt-generic.php
Edit -- https://master.php.net/note/edit/113625
Del: integrated -- https://master.php.net/note/delete/113625/integrated
Del: useless -- https://master.php.net/note/delete/113625/useless
Del: bad code -- https://master.php.net/note/delete/113625/bad+code
Del: spam -- https://master.php.net/note/delete/113625/spam
Del: non-english -- https://master.php.net/note/delete/113625/non-english
Del: in docs -- https://master.php.net/note/delete/113625/in+docs
Del: other reasons-- https://master.php.net/note/delete/113625
Reject -- https://master.php.net/note/reject/113625
Search -- https://master.php.net/manage/user-notes.php