.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Crypt::Digest::TurboSHAKE 3" .TH Crypt::Digest::TurboSHAKE 3 2026-05-12 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Crypt::Digest::TurboSHAKE \- XOF (extendable output) hash functions TurboSHAKE128 and TurboSHAKE256 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Crypt::Digest::TurboSHAKE; \& \& my $d = Crypt::Digest::TurboSHAKE\->new(128); # TurboSHAKE128 \& $d\->add(\*(Aqany data\*(Aq); \& my $result = $d\->done(32); # 32 bytes of output \& \& # or absorb input from a file instead \& my $file_d = Crypt::Digest::TurboSHAKE\->new(128); \& $file_d\->addfile(\*(Aqfilename.dat\*(Aq); \& my $file_result = $file_d\->done(32); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fISince: CryptX\-0.089\fR .PP Provides an interface to TurboSHAKE128 and TurboSHAKE256 as defined in RFC 9861 . .PP TurboSHAKE is a faster variant of SHAKE based on the reduced\-round KeccakP\-1600 permutation. Like SHAKE, it is an XOF (extendable output function): \f(CWdone()\fR can be called multiple times to stream arbitrary amounts of output. .PP After the first \f(CWdone()\fR, treat the object as being in output mode: do not call \f(CWadd()\fR again on that state. Use \f(CWreset()\fR or a new object to start hashing a new message. .SH METHODS .IX Header "METHODS" Unless noted otherwise, assume \f(CW$d\fR is an existing TurboSHAKE object created via \f(CW\*(C`new\*(C'\fR, for example: .PP .Vb 1 \& my $d = Crypt::Digest::TurboSHAKE\->new(128); .Ve .SS new .IX Subsection "new" .Vb 2 \& my $d = Crypt::Digest::TurboSHAKE\->new($num); \& # $num ... [integer] 128 or 256 (selects TurboSHAKE128 or TurboSHAKE256) .Ve .SS clone .IX Subsection "clone" .Vb 1 \& my $d2 = $d\->clone; .Ve .SS reset .IX Subsection "reset" .Vb 1 \& $d\->reset; .Ve .SS add .IX Subsection "add" Appends data to the message. Returns the object itself (for chaining). .PP Each argument is converted to bytes using Perl\*(Aqs usual scalar stringification. Defined scalars, including numbers and string\-overloaded objects, are accepted. \f(CW\*(C`undef\*(C'\fR is treated as an empty string and may emit Perl\*(Aqs usual "uninitialized value" warning. .PP .Vb 3 \& $d\->add(\*(Aqany data\*(Aq); \& #or \& $d\->add(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq); .Ve .SS addfile .IX Subsection "addfile" Reads the file content and appends it to the message. Returns the object itself (for chaining). .PP .Vb 4 \& $d\->addfile(\*(Aqfilename.dat\*(Aq); \& #or \& my $filehandle = ...; # existing binary\-mode filehandle \& $d\->addfile($filehandle); .Ve .SS done .IX Subsection "done" Returns \f(CW$len\fR bytes of output as a binary string. Can be called repeatedly to stream an unlimited amount of output from the same absorbed input. The \&\f(CW$len\fR argument is required and must be a positive integer. Single \&\f(CWdone()\fR calls are limited to 1,000,000,000 bytes, but the recommended way to read large output is to call \f(CWdone()\fR repeatedly in 10 MB chunks. .PP After the first \f(CWdone()\fR call the object is in output mode. Calling \&\f(CWadd()\fR in this state croaks; use \f(CWreset()\fR or create a new object to hash a different message. .PP .Vb 3 \& 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() croaks until you call reset() .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 CryptX, Crypt::Digest::SHAKE, Crypt::Digest::KangarooTwelve .IP \(bu 4 RFC 9861