Crypt::...er::IDEA(3)
πΈ NAME πΈ
Crypt::Cipher::IDEA β symmetric cipher IDEA, key size: 128 bits. this is the Crypt::Cipher::IDEA(3) page from the User Contributed Perl Documentation, and it's literally here to make IDEA make sense, bestie π
β¨
β¨ SYNOPSIS β¨
okay so first, the iconic two-example moment π«Ά
### example 1
use Crypt::Mode::CBC;
my $key = '...'; # length must be a valid key size for this cipher
my $iv = '...'; # 16 bytes
my $cbc = Crypt::Mode::CBC->new('IDEA');
my $ciphertext = $cbc->encrypt("secret data", $key, $iv);
### example 2 (slower)
use Crypt::CBC;
use Crypt::Cipher::IDEA;
my $key = '...'; # length must be a valid key size for this cipher
my $iv = '...'; # 16 bytes
my $cbc = Crypt::CBC->new( -cipher=>'Cipher::IDEA', -key=>$key, -iv=>$iv );
my $ciphertext = $cbc->encrypt("secret data");
π DESCRIPTION π
this module implements the IDEA cipher, and its interface is compatible with Crypt::CBC. no cap.
note, bestie: this module only implements single-block encryption and decryption. for general data, use a block mode such asCrypt::Mode::CBC,Crypt::Mode::CTR, orCrypt::CBCβ and yes,Crypt::CBCis the slower one π
πΈ METHODS πΈ
unless noted otherwise, assume $c is an existing cipher object you made with new, like this:
my $c = Crypt::Cipher::IDEA->new($key);
π new
my $c = Crypt::Cipher::IDEA->new($key);
#or
my $c = Crypt::Cipher::IDEA->new($key, $rounds);
# $key .... [binary string] key of an accepted length (see keysize, min_keysize, max_keysize)
# $rounds . [integer] optional, number of rounds (if supported by the cipher; croaks on invalid value)
so $key is a binary string of an accepted length β check keysize, min_keysize, and max_keysize for the deets. $rounds is optional, an integer, and it's the number of rounds if the cipher supports that. invalid value? it croaks. periodt π
π encrypt
encrypts exactly one block of plaintext. the length of $plaintext must equal blocksize; otherwise it croaks. an empty string is accepted and returned unchanged. yes, literally unchanged π«Ά
my $ciphertext = $c->encrypt($plaintext);
returns the encrypted block as a binary string (raw bytes) β no extra packaging, just the bytes, bestie.
π decrypt
decrypts exactly one block of ciphertext. the length of $ciphertext must equal blocksize; otherwise it croaks. an empty string is accepted and returned unchanged. same energy as encrypt, but reverse π
my $plaintext = $c->decrypt($ciphertext);
returns the decrypted block as a binary string (raw bytes). raw. bytes. iconic.
π keysize
just an alias for max_keysize, lowkey convenient.
$c->keysize;
#or
Crypt::Cipher::IDEA->keysize;
#or
Crypt::Cipher::IDEA::keysize;
π§± blocksize
returns the cipher block size (in bytes). that's the unit, don't forget it β¨
$c->blocksize;
#or
Crypt::Cipher::IDEA->blocksize;
#or
Crypt::Cipher::IDEA::blocksize;
π max_keysize
returns the maximum key size (in bytes). big-key energy.
$c->max_keysize;
#or
Crypt::Cipher::IDEA->max_keysize;
#or
Crypt::Cipher::IDEA::max_keysize;
π§Έ min_keysize
returns the minimum key size (in bytes). small but mighty.
$c->min_keysize;
#or
Crypt::Cipher::IDEA->min_keysize;
#or
Crypt::Cipher::IDEA::min_keysize;
π default_rounds
returns the cipher's default round count. the factory settings, basically π
$c->default_rounds;
#or
Crypt::Cipher::IDEA->default_rounds;
#or
Crypt::Cipher::IDEA::default_rounds;
π SEE ALSO π
CryptX,Crypt::Cipher<https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm>
cute sign-off time: this page is brought to you by perl v5.42.0, dated 2026-05-11, with footer energy reading Crypt::...er::IDEA(3) ππ¦β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms