Crypt::...er::SEED(3)

πŸ’– NAME πŸ’–

Crypt::Cipher::SEED β€” the symmetric cipher SEED, bestie! key size: 128 bits ✨

(it lives in the Perl world too β€” that's the Crypt::...er::SEED(3) energy you saw up top, don't worry about it πŸ’…)


πŸ¦‹ SYNOPSIS πŸ¦‹

ok so here's how you actually use it, two ways, pick your fighter:

### 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('SEED');
my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

### example 2 (slower)
use Crypt::CBC;
use Crypt::Cipher::SEED;

my $key = '...'; # length must be a valid key size for this cipher
my $iv = '...';  # 16 bytes
my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SEED', -key=>$key, -iv=>$iv );
my $ciphertext = $cbc->encrypt("secret data");

no cap, example 2 is literally slower β€” that's the whole note 🫢


🌸 DESCRIPTION 🌸

so this module implements the SEED cipher, and its interface is compatible with Crypt::CBC β€” iconic behavior, honestly πŸ‘‘

⚠️ note, and this one matters: this module only implements single-block encryption and decryption. like, one block. that's it. for general data you need a block mode β€” use something like Crypt::Mode::CBC, Crypt::Mode::CTR, or Crypt::CBC (which is slower). don't come for me, that's just what it says πŸ’€

πŸŽ€ METHODS πŸŽ€

unless noted otherwise, assume $c is an existing cipher object you made via new, like:

my $c = Crypt::Cipher::SEED->new($key);

✨ new

makes you a fresh cipher object, slay:

my $c = Crypt::Cipher::SEED->new($key);
#or
my $c = Crypt::Cipher::SEED->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, max_keysize for what's valid, iykyk. and $rounds is an optional integer for the number of rounds (if the cipher supports it β€” and it croaks on an invalid value, so behave πŸ™ˆ).

πŸ’œ encrypt

encrypts exactly one block of plaintext. the length of $plaintext must equal blocksize, and it croaks otherwise β€” respect the boundary bestie 😭. an empty string is accepted and returned unchanged, which is giving "no thoughts, head empty" and honestly valid.

my $ciphertext = $c->encrypt($plaintext);

returns the encrypted block as a binary string (raw bytes). raw. bytes. periodt πŸ’…

πŸ“ decrypt

decrypts exactly one block of ciphertext. same deal β€” the length of $ciphertext must equal blocksize, croaks otherwise. and yeah, an empty string is accepted and returned unchanged here too πŸŽ€

my $plaintext = $c->decrypt($ciphertext);

returns the decrypted block as a binary string (raw bytes) ✨

🌈 keysize

literally just an alias for max_keysize. that's the whole vibe:

$c->keysize;
#or
Crypt::Cipher::SEED->keysize;
#or
Crypt::Cipher::SEED::keysize;

three ways to call it, all iconic, pick whichever 🫢

⭐ blocksize

returns the cipher block size (in bytes):

$c->blocksize;
#or
Crypt::Cipher::SEED->blocksize;
#or
Crypt::Cipher::SEED::blocksize;

πŸ”₯ max_keysize

returns the maximum key size (in bytes):

$c->max_keysize;
#or
Crypt::Cipher::SEED->max_keysize;
#or
Crypt::Cipher::SEED::max_keysize;

🌸 min_keysize

returns the minimum key size (in bytes):

$c->min_keysize;
#or
Crypt::Cipher::SEED->min_keysize;
#or
Crypt::Cipher::SEED::min_keysize;

🧚 default_rounds

returns the cipher's default round count:

$c->default_rounds;
#or
Crypt::Cipher::SEED->default_rounds;
#or
Crypt::Cipher::SEED::default_rounds;

πŸ‘‘ SEE ALSO πŸ‘‘


so yeah, that's the whole page bestie, go encrypt something single-block and be normal about it πŸ’…βœ¨

sign-off moment: this lil gem ships with perl v5.42.0, dated 2026-05-11, and it's the Crypt::...er::SEED(3) page you've been reading the whole time πŸŽ€ mwah, bye 🫢

πŸ“¦ where this page comes from