1Crypt::Stream::ChaCha(3U)ser Contributed Perl DocumentatiCornypt::Stream::ChaCha(3)
2
3
4

NAME

6       Crypt::Stream::ChaCha - Stream cipher ChaCha
7

SYNOPSIS

9          use Crypt::Stream::ChaCha;
10
11          # encrypt
12          $key = "1234567890123456";
13          $iv  = "123456789012";
14          $stream = Crypt::Stream::ChaCha->new($key, $iv);
15          $ct = $stream->crypt("plain message");
16
17          # decrypt
18          $key = "1234567890123456";
19          $iv  = "123456789012";
20          $stream = Crypt::Stream::ChaCha->new($key, $iv);
21          $pt = $stream->crypt($ct);
22

DESCRIPTION

24       Provides an interface to the ChaCha stream cipher.
25

METHODS

27   new
28        $stream = Crypt::Stream::ChaCha->new($key, $iv);
29        #or
30        $stream = Crypt::Stream::ChaCha->new($key, $iv, $counter, $rounds);
31
32        # $key     .. 32 or 16 bytes
33        # $iv      .. 8 or 12 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

SEE ALSO

49       ·   Crypt::Stream::RC4, Crypt::Stream::Sober128
50
51       ·   <https://tools.ietf.org/html/rfc7539>
52
53
54
55perl v5.28.0                      2017-09-15          Crypt::Stream::ChaCha(3)
Impressum