Crypt-DES
view release on metacpan or search on metacpan
header on Solaris.
- Added META.yml.
2.03 2000-12-05
- Restored "require DynaLoader", missing since 2.00 although
DynaLoader was still listed in @ISA.
- Dropped the stray "package DES;" so blocksize/keysize/new/
encrypt/decrypt are defined in Crypt::DES itself.
- bootstrap now version-checks against $VERSION.
- Declared globals with "use vars".
- Documentation: describe the interface as Crypt::CBC's rather
than Crypt::BlockCipher's.
(2.02 was never released to CPAN.)
2.01 2000-09-11
- Removed a stray #include <stdio.h> from _des.c.
- Comment and dead-code cleanup in DES.pm and test.pl.
2.00 2000-09-11
- Maintenance taken over by Dave Paris / W3Works, LLC.
=head1 SYNOPSIS
use Crypt::DES;
my $key = pack("H16", "0123456789ABCDEF");
my $cipher = Crypt::DES->new($key);
my $ciphertext = $cipher->encrypt($plaintext);
my $plaintext = $cipher->decrypt($ciphertext);
=head1 DESCRIPTION
The module implements the Crypt::CBC interface,
which has the following methods
=over 4
=item blocksize
=item keysize
=item encrypt
my $cipher = Crypt::DES->new($key);
my $ciphertext = $cipher->encrypt("plaintex"); # NB - 8 bytes
print unpack("H16", $ciphertext), "\n";
my $plaintext = $cipher->decrypt($ciphertext);
print $plaintext, "\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. CryptX (Crypt::Cipher::AES) is recommended if you
want to replace Crypt::DES in a Crypt::CBC use case. Otherwise,
replacing it with something like Crypt::AuthEnc::GCM would be
recommended.
=head1 SEE ALSO
Crypt::AuthEnc::GCM
Crypt::Blowfish
Crypt::IDEA
Bruce Schneier, I<Applied Cryptography>, 1995, Second Edition,
In release 2.06, SvUPGRADE was changed to a statement.
In release 2.07, a minor bug in META.yml was fixed.
See Changes introduced in 2.08 for release information.
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 = Benchmark->new();
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 = Crypt::CBC->new(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 1.534 second using v1.01-cache-2.11-cpan-800906f7e73 )