Crypt-DES
view release on metacpan or search on metacpan
Crypt::DES - Perl DES encryption module
=head1 SYNOPSIS
use Crypt::DES;
=head1 DESCRIPTION
The module implements the Crypt::CBC interface,
which has the following methods
=over 4
=item blocksize
=item keysize
=item encrypt
=item decrypt
=back
my $key = pack("H16", "0123456789ABCDEF");
my $cipher = new Crypt::DES $key;
my $ciphertext = $cipher->encrypt("plaintex"); # NB - 8 bytes
print unpack("H16", $ciphertext), "\n";
=head1 NOTES
Do note that DES only uses 8 byte keys and only works on 8 byte data
blocks. If you're intending to encrypt larger blocks or entire files,
please use Crypt::CBC in conjunction with this module. See the
Crypt::CBC documentation for proper syntax and use.
Also note that the DES algorithm is, by today's standard, weak
encryption. Crypt::Blowfish is highly recommended if you're
interested in using strong encryption and a faster algorithm.
=head1 SEE ALSO
Crypt::Blowfish
Crypt::IDEA
_des_ since the 2.04 release didn't seem to fix the problem
on Solaris.
In release 2.06, SvUPGRADE was changed to a statement.
In release 2.07, a minor bug in META.yml was fixed.
Prerequisites
-------------
For the full test suite to run, Crypt::CBC, version 1.22 or higher
is required (recommended is 1.25 or higher), however this module
is not mandatory for standalone DES use, and all other tests
will run to completion.
Installing Crypt::DES
---------------------
nothing unusual:
1. perl Makefile.PL
$cipher->decrypt(pack("H*",'63fac0d034d9f793'));
}
my $t9 = new Benchmark;
my $td4 = timediff($t9,$t8);
my $ts4 = timestr($td4);
print "$ts4\nok 346\n";
}
}
print "\nTesting Cipher Block Chaining..\n";
eval 'use Crypt::CBC';
if(!$@) {
if($Crypt::CBC::VERSION < 1.22) {
$@ = "CBC mode requires Crypt::CBC version 1.22 or higher.";
} else {
my $cipher = new Crypt::CBC(pack("H*","0123456789ABCDEF"),"DES");
my $ciphertext = $cipher->encrypt(pack("H*","37363534333231204E6F77206973207468652074696D6520666F722000"));
my $plaintext = $cipher->decrypt($ciphertext);
if($plaintext ne "7654321 Now is the time for \0") { print "not "; }
print "ok 347 - CBC Mode\n";
}
} # end no errors
if($@) {
print "Error (probably harmless):\n$@\n";
}
print "\nFinished with tests\n\n";
( run in 0.478 second using v1.01-cache-2.11-cpan-df04353d9ac )