For storing passwords, you really don't want encryption, you want a one-way hash function such as crypt
. This allows you to safely "encrypt" (one-way hash) a word but you can never really decrypt. In order to check if the password is valid, you would run the entered password through the one-way hash function and compare that value with the stored value. The unicode req really throws a wrench into things, I'm not sure if crypt
will handle that. There are other one-way hash modules on cpan such as MD5
that may also be helpful.