1Crypt::Mac::BLAKE2s(3)User Contributed Perl DocumentationCrypt::Mac::BLAKE2s(3)
2
3
4
6 Crypt::Mac::BLAKE2s - Message authentication code BLAKE2s MAC (RFC
7 7693)
8
10 ### Functional interface:
11 use Crypt::Mac::BLAKE2s qw( blake2s blake2s_hex );
12
13 # calculate MAC from string/buffer
14 $blake2s_raw = blake2s($size, $key, 'data buffer');
15 $blake2s_hex = blake2s_hex($size, $key, 'data buffer');
16 $blake2s_b64 = blake2s_b64($size, $key, 'data buffer');
17 $blake2s_b64u = blake2s_b64u($size, $key, 'data buffer');
18
19 ### OO interface:
20 use Crypt::Mac::BLAKE2s;
21
22 $d = Crypt::Mac::BLAKE2s->new($size, $key);
23 $d->add('any data');
24 $d->addfile('filename.dat');
25 $d->addfile(*FILEHANDLE);
26 $result_raw = $d->mac; # raw bytes
27 $result_hex = $d->hexmac; # hexadecimal form
28 $result_b64 = $d->b64mac; # Base64 form
29 $result_b64u = $d->b64umac; # Base64 URL Safe form
30
32 Provides an interface to the BLAKE2s message authentication code (MAC)
33 algorithm.
34
36 Nothing is exported by default.
37
38 You can export selected functions:
39
40 use Crypt::Mac::BLAKE2s qw(blake2s blake2s_hex );
41
42 Or all of them at once:
43
44 use Crypt::Mac::BLAKE2s ':all';
45
47 blake2s
48 Logically joins all arguments into a single string, and returns its
49 BLAKE2s message authentication code encoded as a binary string.
50
51 $blake2s_raw = blake2s($size, $key, 'data buffer');
52 #or
53 $blake2s_raw = blake2s($size, $key, 'any data', 'more data', 'even more data');
54
55 blake2s_hex
56 Logically joins all arguments into a single string, and returns its
57 BLAKE2s message authentication code encoded as a hexadecimal string.
58
59 $blake2s_hex = blake2s_hex($size, $key, 'data buffer');
60 #or
61 $blake2s_hex = blake2s_hex($size, $key, 'any data', 'more data', 'even more data');
62
63 blake2s_b64
64 Logically joins all arguments into a single string, and returns its
65 BLAKE2s message authentication code encoded as a Base64 string.
66
67 $blake2s_b64 = blake2s_b64($size, $key, 'data buffer');
68 #or
69 $blake2s_b64 = blake2s_b64($size, $key, 'any data', 'more data', 'even more data');
70
71 blake2s_b64u
72 Logically joins all arguments into a single string, and returns its
73 BLAKE2s message authentication code encoded as a Base64 URL Safe string
74 (see RFC 4648 section 5).
75
76 $blake2s_b64url = blake2s_b64u($size, $key, 'data buffer');
77 #or
78 $blake2s_b64url = blake2s_b64u($size, $key, 'any data', 'more data', 'even more data');
79
81 new
82 $d = Crypt::Mac::BLAKE2s->new($size, $key);
83
84 clone
85 $d->clone();
86
87 reset
88 $d->reset();
89
90 add
91 $d->add('any data');
92 #or
93 $d->add('any data', 'more data', 'even more data');
94
95 addfile
96 $d->addfile('filename.dat');
97 #or
98 $d->addfile(*FILEHANDLE);
99
100 mac
101 $result_raw = $d->mac();
102
103 hexmac
104 $result_hex = $d->hexmac();
105
106 b64mac
107 $result_b64 = $d->b64mac();
108
109 b64umac
110 $result_b64url = $d->b64umac();
111
113 · CryptX
114
115 · <https://tools.ietf.org/html/rfc7693>
116
117
118
119perl v5.28.1 2017-09-15 Crypt::Mac::BLAKE2s(3)