NAME

DES - Perl interface to DES block cipher

SYNOPSIS

use Crypt::DES;

DESCRIPTION

This perl extension is an implementation of the DES block cipher algorithm. The module implements the Crypt::BlockCipher interface, which has the following methods

blocksize =item keysize =item encrypt =item decrypt

FUNCTIONS

blocksize

Returns the size (in bytes) of the block cipher.

keysize

Returns the size (in bytes) of the key.

new
my $cipher = new DES $key;

This creates a new DES BlockCipher object, using $key, where $key is a key of keysize() bytes.

encrypt
my $cipher = new DES $key;
my $ciphertext = $cipher->encrypt($plaintext);

This function encrypts $plaintext and returns the $ciphertext where $plaintext and $ciphertext should be of blocksize() bytes.

decrypt
my $cipher = new DES $key;
my $plaintext = $cipher->decrypt($ciphertext);

This function decrypts $ciphertext and returns the $plaintext where $plaintext and $ciphertext should be of blocksize() bytes.

EXAMPLE

my $key = pack("H16", "0123456789ABCDEF");
my $cipher = new DES $key;
my $ciphertext = $cipher->encrypt("plaintex");	# NB - 8 bytes
print unpack("H16", $ciphertext), "\n";

SEE ALSO

Crypt::IDEA

Bruce Schneier, Applied Cryptography, 1995, Second Edition, published by John Wiley & Sons, Inc.

COPYRIGHT

The implementation of the DES algorithm was developed by, and is copyright of, Eric Young (eay@mincom.oz.au). Other parts of this perl extension are copyright of Systemics Ltd ( http://www.systemics.com/ ).