1Crypt::Stream::Salsa20(U3s)er Contributed Perl DocumentatCiroynpt::Stream::Salsa20(3)
2
3
4
6 Crypt::Stream::Salsa20 - Stream cipher Salsa20
7
9 use Crypt::Stream::Salsa20;
10
11 # encrypt
12 $key = "1234567890123456";
13 $iv = "12345678";
14 $stream = Crypt::Stream::Salsa20->new($key, $iv);
15 $ct = $stream->crypt("plain message");
16
17 # decrypt
18 $key = "1234567890123456";
19 $iv = "12345678";
20 $stream = Crypt::Stream::Salsa20->new($key, $iv);
21 $pt = $stream->crypt($ct);
22
24 Provides an interface to the Salsa20 stream cipher.
25
27 new
28 $stream = Crypt::Stream::Salsa20->new($key, $iv);
29 #or
30 $stream = Crypt::Stream::Salsa20->new($key, $iv, $counter, $rounds);
31
32 # $key .. 32 or 16 bytes
33 # $iv .. 8 bytes
34 # $counter .. initial counter value (DEFAULT: 0)
35 # $rounds .. rounds (DEFAULT: 20)
36
37 crypt
38 $ciphertext = $stream->crypt($plaintext);
39 #or
40 $plaintext = $stream->crypt($ciphertext);
41
42 keystream
43 $random_key = $stream->keystream($length);
44
45 clone
46 $stream->clone();
47
49 • Crypt::Stream::ChaCha, Crypt::Stream::RC4, Crypt::Stream::Sober128,
50 Crypt::Stream::Sosemanuk
51
52
53
54perl v5.36.0 2022-07-22 Crypt::Stream::Salsa20(3)