1Crypt::Mac::BLAKE2b(3)User Contributed Perl DocumentationCrypt::Mac::BLAKE2b(3)
2
3
4

NAME

6       Crypt::Mac::BLAKE2b - Message authentication code BLAKE2b MAC (RFC
7       7693)
8

SYNOPSIS

10          ### Functional interface:
11          use Crypt::Mac::BLAKE2b qw( blake2b blake2b_hex );
12
13          # calculate MAC from string/buffer
14          $blake2b_raw  = blake2b($size, $key, 'data buffer');
15          $blake2b_hex  = blake2b_hex($size, $key, 'data buffer');
16          $blake2b_b64  = blake2b_b64($size, $key, 'data buffer');
17          $blake2b_b64u = blake2b_b64u($size, $key, 'data buffer');
18
19          ### OO interface:
20          use Crypt::Mac::BLAKE2b;
21
22          $d = Crypt::Mac::BLAKE2b->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

DESCRIPTION

32       Provides an interface to the BLAKE2b message authentication code (MAC)
33       algorithm.
34

EXPORT

36       Nothing is exported by default.
37
38       You can export selected functions:
39
40         use Crypt::Mac::BLAKE2b qw(blake2b blake2b_hex );
41
42       Or all of them at once:
43
44         use Crypt::Mac::BLAKE2b ':all';
45

FUNCTIONS

47   blake2b
48       Logically joins all arguments into a single string, and returns its
49       BLAKE2b message authentication code encoded as a binary string.
50
51        $blake2b_raw = blake2b($size, $key, 'data buffer');
52        #or
53        $blake2b_raw = blake2b($size, $key, 'any data', 'more data', 'even more data');
54
55   blake2b_hex
56       Logically joins all arguments into a single string, and returns its
57       BLAKE2b message authentication code encoded as a hexadecimal string.
58
59        $blake2b_hex = blake2b_hex($size, $key, 'data buffer');
60        #or
61        $blake2b_hex = blake2b_hex($size, $key, 'any data', 'more data', 'even more data');
62
63   blake2b_b64
64       Logically joins all arguments into a single string, and returns its
65       BLAKE2b message authentication code encoded as a Base64 string.
66
67        $blake2b_b64 = blake2b_b64($size, $key, 'data buffer');
68        #or
69        $blake2b_b64 = blake2b_b64($size, $key, 'any data', 'more data', 'even more data');
70
71   blake2b_b64u
72       Logically joins all arguments into a single string, and returns its
73       BLAKE2b message authentication code encoded as a Base64 URL Safe string
74       (see RFC 4648 section 5).
75
76        $blake2b_b64url = blake2b_b64u($size, $key, 'data buffer');
77        #or
78        $blake2b_b64url = blake2b_b64u($size, $key, 'any data', 'more data', 'even more data');
79

METHODS

81   new
82        $d = Crypt::Mac::BLAKE2b->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

SEE ALSO

113       ·   CryptX
114
115       ·   <https://tools.ietf.org/html/rfc7693>
116
117
118
119perl v5.28.0                      2017-09-15            Crypt::Mac::BLAKE2b(3)
Impressum