Crypt::...ooTwelve(3)
π Crypt::Digest::KangarooTwelve π
okay so bestie, this is the manual page for Crypt::Digest::KangarooTwelve, and the manual name is Crypt::...ooTwelve(3). Itβs chilling in the User Contributed Perl Documentation, and it is so ready to explain KangarooTwelve to you. π¦β¨
πΈ NAME πΈ
Crypt::Digest::KangarooTwelve - XOF (extendable output) hash function KangarooTwelve. Thatβs the whole name vibe: a XOF hash, KangarooTwelve, no cap. π
π SYNOPSIS π
use Crypt::Digest::KangarooTwelve;
my $d = Crypt::Digest::KangarooTwelve->new(128); # 128-bit security
$d->add('any data');
$d->customization('optional context string');
my $result = $d->done(32); # 32 bytes of output
# or absorb input from a file instead
my $file_d = Crypt::Digest::KangarooTwelve->new(128);
$file_d->addfile('filename.dat');
$file_d->customization('optional context string');
my $file_result = $file_d->done(32);
π¦ DESCRIPTION π¦
Since: CryptX-0.089 β iconic.
It gives you an interface to KangarooTwelve (K12), exactly as defined in RFC 9861 <https://www.rfc-editor.org/rfc/rfc9861>. π§
KangarooTwelve is a fast cryptographic hash and XOF based on a reduced-round (12-round) Keccak-p permutation. It supports an optional customization string that binds the output to a specific context. And done() can be called multiple times to stream arbitrary amounts of output. the way thatβs lowkey delicious π
π¨ Order of operations, bestie:add()must be called beforecustomization();customization()must be called beforedone(). After the firstdone(), treat the object as being in output mode: do not calladd()orcustomization()again on that state. Usereset()or a new object to start hashing a new message.
π METHODS π
Unless noted otherwise, assume $d is an existing KangarooTwelve object created via new, like:
my $d = Crypt::Digest::KangarooTwelve->new(128);
β¨ new β¨
You make a new object with $num, where $num is an integer: 128 or 256 (security level in bits). Signature:
my $d = Crypt::Digest::KangarooTwelve->new($num);
# $num ... [integer] 128 or 256 (security level in bits)
π¦ clone π¦
Clone it, bestie:
my $d2 = $d->clone;
π reset π
Reset it:
$d->reset;
π add π
Appends data to the message. Returns the object itself (for chaining). chaining is the vibe β¨
Each argument is converted to bytes using Perlβs usual scalar stringification. Defined scalars, including numbers and string-overloaded objects, are accepted. "undef" is treated as an empty string and may emit Perlβs usual "uninitialized value" warning.
$d->add('any data');
#or
$d->add('chunk1', 'chunk2', ...);
πΈ addfile πΈ
Reads the file content and appends it to the message. Returns the object itself (for chaining).
$d->addfile('filename.dat');
#or
my $filehandle = ...; # existing binary-mode filehandle
$d->addfile($filehandle);
π¦ customization π¦
$d->customization('context string'); # optional; call after add(), before done()
Each argument is converted to bytes using Perlβs usual scalar stringification. Defined scalars, including numbers and string-overloaded objects, are accepted. "undef" is treated as an empty string and may emit Perlβs usual "uninitialized value" warning.
π done π
Returns $len bytes of output as a binary string. Can be called repeatedly to stream an unlimited amount of output from the same absorbed input. The $len argument is required and must be a positive integer. Single done() calls are limited to 1,000,000,000 bytes, but the recommended way to read large output is to call done() repeatedly in 10 MB chunks. π₯
After the first done() call the object is in output mode. Calling add() or customization() in this state croaks; use reset() or create a new object to hash a different message.
my $result_raw = $d->done($len);
# can be called multiple times; $len is the number of output bytes to read
# after the first done(), add() / customization() croak until you call reset()
π SEE ALSO π
CryptX,Crypt::Digest::SHAKE,Crypt::Digest::TurboSHAKERFC 9861 <https://www.rfc-editor.org/rfc/rfc9861>
mwah π β this page came from perl v5.42.0, dated 2026-05-11, and it lives under the manual name Crypt::...ooTwelve(3). periodt. π
π¦ 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