logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Crypt::DES - Perl DES encryption module

Description

       The module implements the Crypt::CBC interface, which has the following methods

       blocksize =item keysize =item encrypt =item decrypt

Example

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

Functions

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

       keysize
           Returns the size (in bytes) of the key. Optimal size is 8 bytes.

       new
                   my $cipher = new Crypt::DES $key;

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

       encrypt
                   my $cipher = new Crypt::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 Crypt::DES $key;
                   my $plaintext = $cipher->decrypt($ciphertext);

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

Maintainer

       This single-algorithm package and cross-platform code is maintained by Dave Paris <amused@pobox.com>.

perl v5.40.0                                       2024-10-26                                           DES(3pm)

Name

       Crypt::DES - Perl DES encryption module

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.

See Also

       Crypt::Blowfish Crypt::IDEA

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

Synopsis

           use Crypt::DES;

See Also