DES(3)
π NAME π
Crypt::DES β Perl DES encryption module, and yes bestie this is the DES(3) page π
iykyk.
β¨ SYNOPSIS β¨
use Crypt::DES;
πΈ DESCRIPTION πΈ
Okay so the module implements the Crypt::CBC interface, and that interface has these methods:
The page lists them as blocksize =item keysize =item encrypt =item decrypt (POD formatting said what it said π), and lowkey the methods are:
blocksizekeysizeencryptdecrypt
π₯ FUNCTIONS π₯
π blocksize
Returns the size (in bytes) of the block cipher. Slay, that's the block vibe check.
π keysize
Returns the size (in bytes) of the key. Optimal size is 8 bytes, bestie.
π« 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. Main character object energy.
π΅οΈββοΈ 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. Keep it block-sized, periodt.
π 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. Reverse slay π
.
π 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";
Copy-paste this and watch the hex print, bestie. It's giving tiny but iconic demo.
π NOTES π
Do note that DES only uses 8 byte keys and only works on 8 byte data blocks. Literally no bigger keys, no bigger blocks β that's the rule.
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. It's giving βbring a friendβ energy.
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. So if you want strong + faster, ngl, Blowfish is the rec, okay? fr fr.
π¦ SEE ALSO π¦
Obsessed with these references, check them out:
Crypt::BlowfishCrypt::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 the perl extension and module are copyright of Systemics Ltd (http://www.systemics.com/). Cross-platform work and packaging for single algorithm distribution is copyright of W3Works, LLC.
π«Ά MAINTAINER π«Ά
This single-algorithm package and cross-platform code is maintained by Dave Paris <amused@pobox.com>. Say hi, be nice π«Ά.
π cute sign-off: this page is from perl v5.42.0, dated 2024-05-07, and it's the DES(3) manual page. Catch you later, bestie πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Crypt-DES 2.07-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: perl-Crypt-DES 2.07-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: perl-Crypt-DES 2.07-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: perl-Crypt-DES 2.07-160000.2.2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms