bengmau has asked for the wisdom of the Perl Monks concerning the following question:
my code only works with 8 character passwords. How can I make it work for varying length passwords from 4 - 15 characters in length? I'm assuming it has to do with the key size. What do I need to do here? thanks exit;use Crypt::DES; my $plaintext= shift; my $key = pack("H16", "1234567890ABCDEF"); my $cipher = new Crypt::DES $key; my $ciphertext = $cipher->encrypt($plaintext); # NB - 8 bytes print unpack("H16", $ciphertext), "\n"; sub decryptpw { my $key = pack("H16", "1234567890ABCDEF"); my $ciphertext=shift; my $cipher = new Crypt::DES $key; my $plaintext = $cipher->decrypt(pack("H16",$ciphertext)); return $plaintext; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to crypt and decrypt password from 4 to 15 characters in length
by ikegami (Patriarch) on Jan 20, 2006 at 21:38 UTC | |
|
Re: how to crypt and decrypt password from 4 to 15 characters in length
by tirwhan (Abbot) on Jan 20, 2006 at 22:03 UTC | |
|
Re: how to crypt and decrypt password from 4 to 15 characters in length
by Thilosophy (Curate) on Jan 21, 2006 at 07:21 UTC | |
by tirwhan (Abbot) on Jan 21, 2006 at 07:42 UTC | |
by Anonymous Monk on Jan 21, 2006 at 18:37 UTC | |
by tirwhan (Abbot) on Jan 21, 2006 at 19:16 UTC |