mcrypt leaving garbage at end of decoded string

This entry was posted by on Thursday, 6 November, 2008 at

I stumbled upon a problem with the mcrypt library – when decoding (using DES and ECB mode) the encoded string is trailed with leading non-printalbe ASCII characters.  So an encoded “mysecret1” becomes “mysecret1”.

Not shure what causes it, but i found a hack to get rid of those nasty low ASCII chars:


$password = preg_replace("/[\\x00-\\x1F]/", "", $password);

One Response to “mcrypt leaving garbage at end of decoded string”

  1. Vay!!!ìíå ïîíðàâèëîñü!!!


Leave a Reply