Re: PKCS#5 padding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux