1Crypt::PRNG::ChaCha20(3U)ser Contributed Perl DocumentatiCornypt::PRNG::ChaCha20(3)
2
3
4
6 Crypt::PRNG::ChaCha20 - Cryptographically secure PRNG based on ChaCha20
7 (stream cipher) algorithm
8
10 ### Functional interface:
11 use Crypt::PRNG::ChaCha20 qw(random_bytes random_bytes_hex random_bytes_b64 random_string random_string_from rand irand);
12
13 $octets = random_bytes(45);
14 $hex_string = random_bytes_hex(45);
15 $base64_string = random_bytes_b64(45);
16 $base64url_string = random_bytes_b64u(45);
17 $alphanumeric_string = random_string(30);
18 $string = random_string_from('ACGT', 64);
19 $floating_point_number_0_to_1 = rand;
20 $floating_point_number_0_to_88 = rand(88);
21 $unsigned_32bit_int = irand;
22
23 ### OO interface:
24 use Crypt::PRNG::ChaCha20;
25
26 $prng = Crypt::PRNG::ChaCha20->new;
27 #or
28 $prng = Crypt::PRNG::ChaCha20->new("some data used for seeding PRNG");
29
30 $octets = $prng->bytes(45);
31 $hex_string = $prng->bytes_hex(45);
32 $base64_string = $prng->bytes_b64(45);
33 $base64url_string = $prng->bytes_b64u(45);
34 $alphanumeric_string = $prng->string(30);
35 $string = $prng->string_from('ACGT', 64);
36 $floating_point_number_0_to_1 = rand;
37 $floating_point_number_0_to_88 = rand(88);
38 $unsigned_32bit_int = irand;
39
41 Provides an interface to the ChaCha20 based pseudo random number
42 generator
43
44 All methods and functions are the same as for Crypt::PRNG.
45
47 random_bytes
48 See "random_bytes" in Crypt::PRNG.
49
50 random_bytes_hex
51 See "random_bytes_hex" in Crypt::PRNG.
52
53 random_bytes_b64
54 See "random_bytes_b64" in Crypt::PRNG.
55
56 random_bytes_b64u
57 See "random_bytes_b64u" in Crypt::PRNG.
58
59 random_string
60 See "random_string" in Crypt::PRNG.
61
62 random_string_from
63 See "random_string_from" in Crypt::PRNG.
64
65 rand
66 See "rand" in Crypt::PRNG.
67
68 irand
69 See "irand" in Crypt::PRNG.
70
72 new
73 See "new" in Crypt::PRNG.
74
75 bytes
76 See "bytes" in Crypt::PRNG.
77
78 bytes_hex
79 See "bytes_hex" in Crypt::PRNG.
80
81 bytes_b64
82 See "bytes_b64" in Crypt::PRNG.
83
84 bytes_b64u
85 See "bytes_b64u" in Crypt::PRNG.
86
87 string
88 See "string" in Crypt::PRNG.
89
90 string_from
91 See "string_from" in Crypt::PRNG.
92
93 double
94 See "double" in Crypt::PRNG.
95
96 int32
97 See "int32" in Crypt::PRNG.
98
100 • Crypt::PRNG
101
102 • <https://tools.ietf.org/html/rfc7539>
103
104
105
106perl v5.36.0 2022-07-22 Crypt::PRNG::ChaCha20(3)