.\" -*- 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::Stream::Sober128 3" .TH Crypt::Stream::Sober128 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::Stream::Sober128 \- Stream cipher Sober128 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Crypt::Stream::Sober128; \& \& # encrypt \& my $key = "1234567890123456"; \& my $iv = "123456789012"; \& my $enc_stream = Crypt::Stream::Sober128\->new($key, $iv); \& my $ct = $enc_stream\->crypt("plain message"); \& \& # decrypt \& my $dec_stream = Crypt::Stream::Sober128\->new($key, $iv); \& my $pt = $dec_stream\->crypt($ct); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Provides an interface to the Sober128 stream cipher. .SH METHODS .IX Header "METHODS" Unless noted otherwise, assume \f(CW$stream\fR is an existing stream object created via \f(CW\*(C`new\*(C'\fR, for example: .PP .Vb 1 \& my $stream = Crypt::Stream::Sober128\->new($key, $iv); .Ve .SS new .IX Subsection "new" .Vb 3 \& my $stream = Crypt::Stream::Sober128\->new($key, $iv); \& # $key .. [binary string] keylen must be multiple of 4 bytes \& # $iv .. [binary string] ivlen must be multiple of 4 bytes .Ve .SS crypt .IX Subsection "crypt" Encrypts or decrypts data. The output has the same length as the input. Returns a binary string (raw bytes). .PP The input is converted using Perl\*(Aqs usual scalar stringification. Passing \&\f(CW\*(C`undef\*(C'\fR is treated as an empty string with the usual warning, and numeric scalars are stringified before processing. .PP .Vb 3 \& my $ciphertext = $stream\->crypt($plaintext); \& #or \& my $plaintext = $stream\->crypt($ciphertext); .Ve .SS keystream .IX Subsection "keystream" Returns \f(CW$length\fR bytes of raw keystream as a binary string. .PP The length is taken using Perl\*(Aqs usual numeric coercion. Values that coerce to an oversized unsigned length are rejected as too large. .PP .Vb 1 \& my $random_key = $stream\->keystream($length); .Ve .SS clone .IX Subsection "clone" Returns a copy of the stream cipher object in its current state. .PP .Vb 1 \& my $stream2 = $stream\->clone(); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 Crypt::Stream::RC4, Crypt::Stream::ChaCha, Crypt::Stream::Salsa20, Crypt::Stream::Sosemanuk .IP \(bu 4