1Crypt::Digest::CHAES(3)User Contributed Perl DocumentatioCnrypt::Digest::CHAES(3)
2
3
4

NAME

6       Crypt::Digest::CHAES - Hash function - CipherHash based on AES [size:
7       128 bits]
8

SYNOPSIS

10          ### Functional interface:
11          use Crypt::Digest::CHAES qw( chaes chaes_hex chaes_b64 chaes_b64u
12                                       chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u );
13
14          # calculate digest from string/buffer
15          $chaes_raw  = chaes('data string');
16          $chaes_hex  = chaes_hex('data string');
17          $chaes_b64  = chaes_b64('data string');
18          $chaes_b64u = chaes_b64u('data string');
19          # calculate digest from file
20          $chaes_raw  = chaes_file('filename.dat');
21          $chaes_hex  = chaes_file_hex('filename.dat');
22          $chaes_b64  = chaes_file_b64('filename.dat');
23          $chaes_b64u = chaes_file_b64u('filename.dat');
24          # calculate digest from filehandle
25          $chaes_raw  = chaes_file(*FILEHANDLE);
26          $chaes_hex  = chaes_file_hex(*FILEHANDLE);
27          $chaes_b64  = chaes_file_b64(*FILEHANDLE);
28          $chaes_b64u = chaes_file_b64u(*FILEHANDLE);
29
30          ### OO interface:
31          use Crypt::Digest::CHAES;
32
33          $d = Crypt::Digest::CHAES->new;
34          $d->add('any data');
35          $d->addfile('filename.dat');
36          $d->addfile(*FILEHANDLE);
37          $result_raw  = $d->digest;     # raw bytes
38          $result_hex  = $d->hexdigest;  # hexadecimal form
39          $result_b64  = $d->b64digest;  # Base64 form
40          $result_b64u = $d->b64udigest; # Base64 URL Safe form
41

DESCRIPTION

43       Provides an interface to the CHAES digest algorithm.
44

EXPORT

46       Nothing is exported by default.
47
48       You can export selected functions:
49
50         use Crypt::Digest::CHAES qw(chaes chaes_hex chaes_b64 chaes_b64u
51                                             chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u);
52
53       Or all of them at once:
54
55         use Crypt::Digest::CHAES ':all';
56

FUNCTIONS

58   chaes
59       Logically joins all arguments into a single string, and returns its
60       CHAES digest encoded as a binary string.
61
62        $chaes_raw = chaes('data string');
63        #or
64        $chaes_raw = chaes('any data', 'more data', 'even more data');
65
66   chaes_hex
67       Logically joins all arguments into a single string, and returns its
68       CHAES digest encoded as a hexadecimal string.
69
70        $chaes_hex = chaes_hex('data string');
71        #or
72        $chaes_hex = chaes_hex('any data', 'more data', 'even more data');
73
74   chaes_b64
75       Logically joins all arguments into a single string, and returns its
76       CHAES digest encoded as a Base64 string, with trailing '=' padding.
77
78        $chaes_b64 = chaes_b64('data string');
79        #or
80        $chaes_b64 = chaes_b64('any data', 'more data', 'even more data');
81
82   chaes_b64u
83       Logically joins all arguments into a single string, and returns its
84       CHAES digest encoded as a Base64 URL Safe string (see RFC 4648 section
85       5).
86
87        $chaes_b64url = chaes_b64u('data string');
88        #or
89        $chaes_b64url = chaes_b64u('any data', 'more data', 'even more data');
90
91   chaes_file
92       Reads file (defined by filename or filehandle) content, and returns its
93       CHAES digest encoded as a binary string.
94
95        $chaes_raw = chaes_file('filename.dat');
96        #or
97        $chaes_raw = chaes_file(*FILEHANDLE);
98
99   chaes_file_hex
100       Reads file (defined by filename or filehandle) content, and returns its
101       CHAES digest encoded as a hexadecimal string.
102
103        $chaes_hex = chaes_file_hex('filename.dat');
104        #or
105        $chaes_hex = chaes_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   chaes_file_b64
111       Reads file (defined by filename or filehandle) content, and returns its
112       CHAES digest encoded as a Base64 string, with trailing '=' padding.
113
114        $chaes_b64 = chaes_file_b64('filename.dat');
115        #or
116        $chaes_b64 = chaes_file_b64(*FILEHANDLE);
117
118   chaes_file_b64u
119       Reads file (defined by filename or filehandle) content, and returns its
120       CHAES digest encoded as a Base64 URL Safe string (see RFC 4648 section
121       5).
122
123        $chaes_b64url = chaes_file_b64u('filename.dat');
124        #or
125        $chaes_b64url = chaes_file_b64u(*FILEHANDLE);
126

METHODS

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

SEE ALSO

174       •   CryptX, Crypt::Digest
175
176       •   <http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers>
177
178
179
180perl v5.34.0                      2021-07-22           Crypt::Digest::CHAES(3)
Impressum