1Crypt::Digest::BLAKE2s_U1s2e8r(3C)ontributed Perl DocumeCnrtyaptti:o:nDigest::BLAKE2s_128(3)
2
3
4

NAME

6       Crypt::Digest::BLAKE2s_128 - Hash function BLAKE2s [size: 128 bits]
7

SYNOPSIS

9          ### Functional interface:
10          use Crypt::Digest::BLAKE2s_128 qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u
11                                       blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u );
12
13          # calculate digest from string/buffer
14          $blake2s_128_raw  = blake2s_128('data string');
15          $blake2s_128_hex  = blake2s_128_hex('data string');
16          $blake2s_128_b64  = blake2s_128_b64('data string');
17          $blake2s_128_b64u = blake2s_128_b64u('data string');
18          # calculate digest from file
19          $blake2s_128_raw  = blake2s_128_file('filename.dat');
20          $blake2s_128_hex  = blake2s_128_file_hex('filename.dat');
21          $blake2s_128_b64  = blake2s_128_file_b64('filename.dat');
22          $blake2s_128_b64u = blake2s_128_file_b64u('filename.dat');
23          # calculate digest from filehandle
24          $blake2s_128_raw  = blake2s_128_file(*FILEHANDLE);
25          $blake2s_128_hex  = blake2s_128_file_hex(*FILEHANDLE);
26          $blake2s_128_b64  = blake2s_128_file_b64(*FILEHANDLE);
27          $blake2s_128_b64u = blake2s_128_file_b64u(*FILEHANDLE);
28
29          ### OO interface:
30          use Crypt::Digest::BLAKE2s_128;
31
32          $d = Crypt::Digest::BLAKE2s_128->new;
33          $d->add('any data');
34          $d->addfile('filename.dat');
35          $d->addfile(*FILEHANDLE);
36          $result_raw  = $d->digest;     # raw bytes
37          $result_hex  = $d->hexdigest;  # hexadecimal form
38          $result_b64  = $d->b64digest;  # Base64 form
39          $result_b64u = $d->b64udigest; # Base64 URL Safe form
40

DESCRIPTION

42       Provides an interface to the BLAKE2s_128 digest algorithm.
43

EXPORT

45       Nothing is exported by default.
46
47       You can export selected functions:
48
49         use Crypt::Digest::BLAKE2s_128 qw(blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u
50                                             blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u);
51
52       Or all of them at once:
53
54         use Crypt::Digest::BLAKE2s_128 ':all';
55

FUNCTIONS

57   blake2s_128
58       Logically joins all arguments into a single string, and returns its
59       BLAKE2s_128 digest encoded as a binary string.
60
61        $blake2s_128_raw = blake2s_128('data string');
62        #or
63        $blake2s_128_raw = blake2s_128('any data', 'more data', 'even more data');
64
65   blake2s_128_hex
66       Logically joins all arguments into a single string, and returns its
67       BLAKE2s_128 digest encoded as a hexadecimal string.
68
69        $blake2s_128_hex = blake2s_128_hex('data string');
70        #or
71        $blake2s_128_hex = blake2s_128_hex('any data', 'more data', 'even more data');
72
73   blake2s_128_b64
74       Logically joins all arguments into a single string, and returns its
75       BLAKE2s_128 digest encoded as a Base64 string, with trailing '='
76       padding.
77
78        $blake2s_128_b64 = blake2s_128_b64('data string');
79        #or
80        $blake2s_128_b64 = blake2s_128_b64('any data', 'more data', 'even more data');
81
82   blake2s_128_b64u
83       Logically joins all arguments into a single string, and returns its
84       BLAKE2s_128 digest encoded as a Base64 URL Safe string (see RFC 4648
85       section 5).
86
87        $blake2s_128_b64url = blake2s_128_b64u('data string');
88        #or
89        $blake2s_128_b64url = blake2s_128_b64u('any data', 'more data', 'even more data');
90
91   blake2s_128_file
92       Reads file (defined by filename or filehandle) content, and returns its
93       BLAKE2s_128 digest encoded as a binary string.
94
95        $blake2s_128_raw = blake2s_128_file('filename.dat');
96        #or
97        $blake2s_128_raw = blake2s_128_file(*FILEHANDLE);
98
99   blake2s_128_file_hex
100       Reads file (defined by filename or filehandle) content, and returns its
101       BLAKE2s_128 digest encoded as a hexadecimal string.
102
103        $blake2s_128_hex = blake2s_128_file_hex('filename.dat');
104        #or
105        $blake2s_128_hex = blake2s_128_file_hex(*FILEHANDLE);
106
107       BEWARE: You have to make sure that the filehandle is in binary mode
108       before you pass it as argument to the addfile() method.
109
110   blake2s_128_file_b64
111       Reads file (defined by filename or filehandle) content, and returns its
112       BLAKE2s_128 digest encoded as a Base64 string, with trailing '='
113       padding.
114
115        $blake2s_128_b64 = blake2s_128_file_b64('filename.dat');
116        #or
117        $blake2s_128_b64 = blake2s_128_file_b64(*FILEHANDLE);
118
119   blake2s_128_file_b64u
120       Reads file (defined by filename or filehandle) content, and returns its
121       BLAKE2s_128 digest encoded as a Base64 URL Safe string (see RFC 4648
122       section 5).
123
124        $blake2s_128_b64url = blake2s_128_file_b64u('filename.dat');
125        #or
126        $blake2s_128_b64url = blake2s_128_file_b64u(*FILEHANDLE);
127

METHODS

129       The OO interface provides the same set of functions as Crypt::Digest.
130
131   new
132        $d = Crypt::Digest::BLAKE2s_128->new();
133
134   clone
135        $d->clone();
136
137   reset
138        $d->reset();
139
140   add
141        $d->add('any data');
142        #or
143        $d->add('any data', 'more data', 'even more data');
144
145   addfile
146        $d->addfile('filename.dat');
147        #or
148        $d->addfile(*FILEHANDLE);
149
150   add_bits
151        $d->add_bits($bit_string);   # e.g. $d->add_bits("111100001010");
152        #or
153        $d->add_bits($data, $nbits); # e.g. $d->add_bits("\xF0\xA0", 16);
154
155   hashsize
156        $d->hashsize;
157        #or
158        Crypt::Digest::BLAKE2s_128->hashsize();
159        #or
160        Crypt::Digest::BLAKE2s_128::hashsize();
161
162   digest
163        $result_raw = $d->digest();
164
165   hexdigest
166        $result_hex = $d->hexdigest();
167
168   b64digest
169        $result_b64 = $d->b64digest();
170
171   b64udigest
172        $result_b64url = $d->b64udigest();
173

SEE ALSO

175       •   CryptX, Crypt::Digest
176
177       •   <https://blake2.net/>
178
179       •   <https://tools.ietf.org/html/rfc7693>
180
181
182
183perl v5.34.0                      2021-07-22     Crypt::Digest::BLAKE2s_128(3)
Impressum