NYCPHP Meetup

NYPHP.org

[nycphp-talk] MCrypt problems decrypting data

csnyder chsnyder at gmail.com
Sat Aug 18 09:17:43 EDT 2007


On 8/18/07, csnyder <chsnyder at gmail.com> wrote:
>
> You need to use the same initialization vector (IV) to decrypt as you
> did to encrypt. Typically, after encryption, you prepend the iv to the
> ciphertext value and store the whole thing (iv+encrypted). When you're
> ready to decrypt, you chop the iv off the front and use it to decrypt
> the ciphertext.
>
> Second, how are you generating the key? Is it a multiple of 32 characters long?
>

There's a nifty little class that will do this for you in the source
code for Pro PHP Security. See ch06-encryption/mcrypt.php:
http://www.apress.com/book/supplementDownload.html?bID=437&sID=2888



More information about the talk mailing list