IDEA(3)

πŸ“¦
version 1.10 Β· 4 versions
, in epel 9

✨ 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:

  • blocksize
  • keysize
  • encrypt
  • decrypt

(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::CBD
  • Crypt::DES
  • Crypt::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.


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