Crypt:...bkeyed(3pm)
π Crypt::Eksblowfish::Subkeyed(3pm) β the manual, but make it cute π
User Contributed Perl Documentation Β· yeah bestie, this is the Crypt::Eksblowfish::Subkeyed page, and it's literally about Blowfish/Eksblowfish with access to subkeys π‘β¨
β¨ NAME β¨
Crypt::Eksblowfish::Subkeyed β Blowfish/Eksblowfish with access to subkeys π«Ά
πΈ SYNOPSIS πΈ
okay so here's the whole vibe, copy-paste ready:
use Crypt::Eksblowfish::Subkeyed;
$block_size = Crypt::Eksblowfish::Subkeyed->blocksize;
$cipher = Crypt::Eksblowfish::Subkeyed
->new_from_subkeys(\@p_array, \@s_boxes);
$cipher = Crypt::Eksblowfish::Subkeyed->new_initial;
$block_size = $cipher->blocksize;
$ciphertext = $cipher->encrypt($plaintext);
$plaintext = $cipher->decrypt($ciphertext);
$p_array = $cipher->p_array;
$s_boxes = $cipher->s_boxes;
if($cipher->is_weak) { ...
π¦ DESCRIPTION π¦
An object of this class encapsulates a keyed instance of the Blowfish or Eksblowfish block cipher, ready to encrypt and decrypt. π
Normally this class will not be used directly, but through subclasses such as Crypt::Eksblowfish. Like, it's the backstage crew, not the main character.
Eksblowfish is a variant of the Blowfish cipher with a modified key setup algorithm. This class doesn't implement either form of key setup β nope, not its job β it only provides the actual encryption and decryption parts of the ciphers. This part is shared between Blowfish and Eksblowfish, and also any other cipher that uses the core of Blowfish but supplies its own key setup. The reason this class has the name "Eksblowfish" in it rather than "Blowfish" is honestly just a historical accident π β it's derived from the encryption engine that was used to implement Eksblowfish.
The key setup phase of a block cipher, also known as the "key schedule", produces a set of "subkeys", which are somewhat like ordinary cryptographic keys (which are the input to the key setup algorithm) but are much larger. In some block ciphers the subkeys also have special interrelationships. In Blowfish the subkeys consist of a "P-array" of 18 32-bit entries (one per encryption round plus two more) and four "S-boxes" ("S" is for "substitution") each of which consists of 256 32-bit entries. There is no special relationship between the values of the subkeys. No drama between them, they just exist π
Methods in this class allow a cipher object to be constructed from a full set of subkeys, and for the subkeys to be extracted from a cipher object. Normal users don't need to do either of these things π. It's mainly useful when devising a new key schedule to stick onto the Blowfish core, or when performing cryptanalysis of the cipher algorithm. So: researchers and gremlins only.
Generating subkeys directly by a strong random process, rather than by expansion of a smaller random key, is an expensive and slightly bizarre way to get greater cryptographic strength from a cipher algorithm. It eliminates attacks on the key schedule, and yields the full strength of the core algorithm. HOWEVER π β this is always a lot less strength than the amount of subkey material, whereas a normal key schedule is designed to yield strength equal to the length of the (much shorter) key. Also, any non-randomness in the source of the subkey material is likely to lead to a cryptographic weakness, whereas a key schedule conceals any non-randomness in the choice of the key. So likeβ¦ slay, but carefully? β οΈ
π CLASS METHODS π
Crypt::Eksblowfish::Subkeyed->blocksize
Returns 8, indicating the Eksblowfish block size of 8 octets. This method may be called on either the class or an instance. Both. Either. She's flexible π
π CONSTRUCTOR π
Crypt::Eksblowfish::Subkeyed->new_from_subkeys(ROUND_KEYS, SBOXES)
Creates a new Blowfish cipher object encapsulating the supplied subkeys. ROUND_KEYS must be a reference to an array of 18 32-bit integers. SBOXES must be a reference to an array of four references to 256-element arrays of 32-bit integers. These subkeys are used in the standard order for Blowfish. So that's 18, then 4Γ256. Do not freestyle the shape of these, bestie π«
Crypt::Eksblowfish::Subkeyed->new_initial
The standard Blowfish key schedule is an iterative process, which uses the cipher algorithm to progressively replace subkeys, thus mutating the cipher for subsequent iterations of keying. The Eksblowfish key schedule works similarly, but with a lot more iterations. In both cases, the key setup algorithm begins with a standard set of subkeys, consisting of the initial bits of the fractional part of pi π₯§. This constructor creates and returns a Blowfish block cipher object with that standard initial set of subkeys. This is probably useful only to designers of novel key schedules. Niche queen behavior, we respect it β¨
β METHODS β
$cipher->blocksizeβ Returns8, indicating the Eksblowfish block size of 8 octets. This method may be called on either the class or an instance.$cipher->encrypt(PLAINTEXT)βPLAINTEXTmust be exactly eight octets. The block is encrypted, and the ciphertext is returned. Eight. Exactly eight. Not seven, not nine π₯$cipher->decrypt(CIPHERTEXT)βCIPHERTEXTmust be exactly eight octets. The block is decrypted, and the plaintext is returned. Again: exactly eight π$cipher->p_arrayβ Returns a reference to an 18-element array containing the 32-bit round keys used in this cipher object.$cipher->s_boxesβ Returns a reference to a 4-element array containing the S-boxes used in this cipher object. Each S-box is a 256-element array of 32-bit entries.$cipher->is_weakβ Returns a truth value indicating whether this is a weak key. A key is considered weak if any S-box contains a pair of identical entries (in any positions). When Blowfish is used with such an S-box, certain cryptographic attacks are possible that are not possible against most keys. The current (as of 2007) cryptanalytic results on Blowfish do not include an actual break of the algorithm when weak keys are used, but if a break is ever developed then it is likely to be achieved for weak keys before it is achieved for the general case. π¨
About one key in every 2^15 is weak (if the keys are randomly selected). Because of the complicated key schedule in standard Blowfish it is not possible to predict which keys will be weak without first performing the full key setup, which is why this is a method on the keyed cipher object. In some uses of Blowfish it may be desired to avoid weak keys; if so, check using this method and generate a new random key when a weak key is detected. Bruce Schneier, the designer of Blowfish, says it is probably not worth avoiding weak keys. And honestly? We trust Bruce π«Ά
π SEE ALSO π
Crypt::EksblowfishCrypt::Eksblowfish::Blowfish<http://www.schneier.com/paper-blowfish-fse.html>
π AUTHOR π
Eksblowfish guts originally by Solar Designer (solar at openwall.com).
Modifications and Perl interface by Andrew Main (Zefram) <zefram@fysh.org>.
π COPYRIGHT π
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Andrew Main (Zefram) <zefram@fysh.org>
The original Eksblowfish code (in the form of crypt()) from which this module is derived is in the public domain. It may be found at <http://www.openwall.com/crypt/>.
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie β no notes, no skipped sections, every last flag and number accounted for β¨
perl v5.42.3 Β· 2026-08-19 β mwah, thanks for reading, go encrypt something eight octets long, ily ππ¦πΈ
π¦ where this page comes from
- ubuntu stonking: libcrypt-eksblowfish-perl 0.009-3build6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms