Re: PKCS#5 padding

From: Date: Fri, 09 Dec 2005 15:53:15 +0000
Subject: Re: PKCS#5 padding
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-227208@lists.php.net to get a copy of this message
Ummmm.... I made a mistake in the second test for validity in the unpad function. It should be this: function pkcs5_unpad ($text) { $pad = ord($text{strlen($text)-1}); if ($pad > strlen($text)) return false; if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false; return substr($text, 0, -1 * $pad); }

« previous php.general (#227208) next »