IDEA(3)
β¨ IDEA β Perl interface to IDEA block cipher β¨
okay bestie so this is IDEA(3), a section-3 manual page for the Perl IDEA module, and it's literally your ticket into the IDEA block cipher from Perl. buckle up, it's a short one and it ate π
πΈ NAME πΈ
IDEA β the Perl interface to the IDEA block cipher. that's it, that's the vibe. no cap.
π¦ SYNOPSIS π¦
use Crypt::IDEA;
one line. iconic. she's low maintenance.
π DESCRIPTION π
so this perl extension is an implementation of the IDEA block cipher algorithm. periodt. π
the module implements the Crypt::BlockCipher interface, which has the following methods β here's the whole squad:
blocksizekeysizeencryptdecrypt
(that's fr fr the list, no extras, no gatekeeping π«Ά)
π FUNCTIONS π
β blocksize
returns the size (in bytes) of the block cipher. that's the input/output chunk size, bestie β memorise it, you'll need it.
β keysize
returns the size (in bytes) of the key. yes, also in bytes. we stay consistent β¨
β new
my $cipher = new IDEA $key;
this creates a new IDEA BlockCipher object, using $key, where $key is a key of keysize() bytes. so likeβ¦ check your key length first, or it's giving chaos π
β encrypt
my $cipher = new IDEA $key;
my $ciphertext = $cipher->encrypt($plaintext);
this function encrypts $plaintext and returns the $ciphertext, where $plaintext and $ciphertext should be of blocksize() bytes. both of them. same size. don't come at me with a 5-byte plaintext π
β decrypt
my $cipher = new IDEA $key;
my $plaintext = $cipher->decrypt($ciphertext);
this function decrypts $ciphertext and returns the $plaintext, where $plaintext and $ciphertext should be of blocksize() bytes. the inverse of the above, obviously β round trip queen π
π EXAMPLE π
okay here's a whole actual working moment:
my $key = pack("H32", "0123456789ABCDEF0123456789ABCDEF");
my $cipher = new IDEA $key;
my $ciphertext = $cipher->encrypt("plaintex"); # NB - 8 bytes
print unpack("H16", $ciphertext), "\n";
and yes bestie, look at that comment β # NB - 8 bytes β "plaintex" is 8 bytes on purpose, because block size. not me noticing you counting on your fingers π it's exactly blocksize() bytes, that's the whole point.
π₯ SEE ALSO π₯
Crypt::CBDCrypt::DESCrypt::Blowfish
and for the reading list moment π β Bruce Schneier, Applied Cryptography, 1995, Second Edition, published by John Wiley & Sons, Inc. yes it's on the syllabus.
π COPYRIGHT π
this implementation is copyright Systemics Ltd ( http://www.systemics.com/ ).
β οΈ also important, bestie: the IDEA algorithm is patented in Europe and the United States by Ascom-Tech AG. not a drill, that's a real legal situation, keep it in mind π«Ά
module altered between 1999 and 2005 to allow added functionality with perl -MCPAN, Changes by Dave Paris (edited lib paths, endian issues, new tests).
thank you to contributors for endian patches and new test suite! π seriously, legends.
and that's the whole page π¦ mwah π this one was perl v5.32.1, dated 2019-07-26 β so if you're citing it in the group chat, that's the version and that's the date, iykyk β¨
π¦ where this page comes from
- epel 9: perl-Crypt-IDEA 1.10-16.el9 Β· BSD with advertising
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms