Nesh has asked for the wisdom of the Perl Monks concerning the following question:

I am trying encryption and decryption below. What is the error.
#!/usr/bin/perl use warnings; use Crypt::DES; my $key = pack("H16", "0123456789ABCDEF"); my $cipher = new Crypt::DES $key; my $plaintext = "neshataf"; my $ciphertext = $cipher->encrypt($plaintext); # NB - 8 bytes $plaintext = $cipher->decrypt($ciphertext); print unpack("H16", $ciphertext), "\n"; print unpack("H16", $plaintext), "\n";
After decryption the result should be "neshataf" if I understood it properly. But the result is not that. Please help.

Replies are listed 'Best First'.
Re: Decryption in perl
by Tanktalus (Canon) on Mar 10, 2005 at 01:20 UTC

    I'm curious as to why you're unpacking your plaintext. Just print it out. (Just installed Crypt::DES and tried it out - seems to work.)

      Thanks for your help. It worked for me also.