cipher doc fixes
Karel Miko
10 years ago
25 | 25 | |
26 | 26 | ### example 1 |
27 | 27 | use Crypt::Mode::CBC; |
28 | ||
28 | ||
29 | 29 | my $key = '...'; # length has to be valid key size for this cipher |
30 | 30 | my $iv = '...'; # 16 bytes |
31 | 31 | my $cbc = Crypt::Mode::CBC->new('[%orig_name%]'); |
34 | 34 | ### example 2 |
35 | 35 | use Crypt::CBC; |
36 | 36 | use Crypt::Cipher::[%orig_name%]; |
37 | ||
37 | ||
38 | 38 | my $key = '...'; # length has to be valid key size for this cipher |
39 | 39 | my $iv = '...'; # 16 bytes |
40 | 40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::[%orig_name%]', -key=>$key, -iv=>$iv ); |
106 | 106 | |
107 | 107 | =head1 SEE ALSO |
108 | 108 | |
109 | =over 4 | |
109 | =over | |
110 | 110 | |
111 | 111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> |
112 | 112 | [% FOREACH v IN urls %] |
37 | 37 | =head1 SYNOPSIS |
38 | 38 | |
39 | 39 | ### Functional interface: |
40 | use Crypt::Digest::[%orig_name%] qw( [%lc_name%] [%lc_name%]_hex [%lc_name%]_b64 [%lc_name%]_b64u | |
40 | use Crypt::Digest::[%orig_name%] qw( [%lc_name%] [%lc_name%]_hex [%lc_name%]_b64 [%lc_name%]_b64u | |
41 | 41 | [%lc_name%]_file [%lc_name%]_file_hex [%lc_name%]_file_b64 [%lc_name%]_file_b64u ); |
42 | 42 | |
43 | 43 | # calculate digest from string/buffer |
13 | 13 | { |
14 | 14 | STRLEN k_len=0; |
15 | 15 | unsigned char *k=NULL; |
16 | int rv; | |
16 | int rv; | |
17 | 17 | [%-IF lc_name == 'hmac' %] |
18 | 18 | int id; |
19 | 19 | |
34 | 34 | if (!RETVAL) croak("FATAL: Newz failed"); |
35 | 35 | |
36 | 36 | [%-IF lc_name == 'pelican' %] |
37 | rv = [%lc_name%]_init(&RETVAL->state, k, (unsigned long)k_len); | |
37 | rv = [%lc_name%]_init(&RETVAL->state, k, (unsigned long)k_len); | |
38 | 38 | [%-ELSE%] |
39 | 39 | rv = [%lc_name%]_init(&RETVAL->state, id, k, (unsigned long)k_len); |
40 | 40 | [%-END%] |
65 | 65 | STRLEN in_data_len; |
66 | 66 | unsigned char *in_data; |
67 | 67 | |
68 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
68 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
69 | 69 | if (in_data_len>0) { |
70 | 70 | rv = [%lc_name%]_process(&self->state, in_data, (unsigned long)in_data_len); |
71 | 71 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_process failed: %s", error_to_string(rv)); |
115 | 115 | [%-END%] |
116 | 116 | outlen = sizeof(mac_base64); |
117 | 117 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); |
118 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
118 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
119 | 119 | RETVAL = newSVpvn(mac_base64, outlen); |
120 | 120 | } |
121 | 121 | OUTPUT: |
142 | 142 | [%-END%] |
143 | 143 | outlen = sizeof(mac_base64); |
144 | 144 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); |
145 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
145 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
146 | 146 | RETVAL = newSVpvn(mac_base64, outlen); |
147 | 147 | } |
148 | 148 | OUTPUT: |
69 | 69 | my $m = Crypt::Mode::[%orig_name%]->new($cipher_name, $ctr_mode, $ctr_width); |
70 | 70 | #or |
71 | 71 | my $m = Crypt::Mode::[%orig_name%]->new($cipher_name, $ctr_mode, $ctr_width, $cipher_rounds); |
72 | ||
72 | ||
73 | 73 | # $ctr_mode .... 0 little-endian counter (DEFAULT) |
74 | 74 | # 1 big-endian counter |
75 | 75 | # 2 little-endian + RFC3686 incrementing |
94 | 94 | |
95 | 95 | # $cipher_rounds ... optional num of rounds for given cipher |
96 | 96 | [%-END%] |
97 | ||
97 | ||
98 | 98 | =head2 encrypt |
99 | 99 | |
100 | 100 | [%-IF lc_name == 'ecb' %] |
105 | 105 | in_data_len = 0; |
106 | 106 | } |
107 | 107 | } /* padlen > 0 */ |
108 | ||
108 | ||
109 | 109 | i = (unsigned long)(in_data_len % blen); |
110 | 110 | if (in_data_len>0 && i>0) { /* save tail of data into pad */ |
111 | 111 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); |
112 | 112 | self->padlen = i; |
113 | 113 | in_data_len -= i; |
114 | 114 | } |
115 | ||
115 | ||
116 | 116 | if (in_data_len>0) { |
117 | 117 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); |
118 | 118 | RETVAL = NEWSV(0, i); |
119 | 119 | SvPOK_only(RETVAL); |
120 | 120 | SvCUR_set(RETVAL, i); |
121 | 121 | out_data = (unsigned char *)SvPV_nolen(RETVAL); |
122 | ||
122 | ||
123 | 123 | if (has_tmp_block) { |
124 | 124 | Copy(tmp_block, out_data, blen, unsigned char); |
125 | 125 | out_data += blen; |
144 | 144 | { |
145 | 145 | unsigned char tmp_block[MAXBLOCKSIZE]; |
146 | 146 | int rv, blen, i, j; |
147 | ||
147 | ||
148 | 148 | blen = (&self->state)->blocklen; |
149 | 149 | if (self->padlen<0 || self->padlen>=blen) croak("FATAL: invalid padlen"); |
150 | ||
150 | ||
151 | 151 | if(self->padding_mode == 1) { /* pkcs5|7 padding */ |
152 | 152 | i = blen - self->padlen; |
153 | 153 | if (i == 0) i = blen; |
159 | 159 | self->pad[self->padlen] = 0x80; |
160 | 160 | for(j=self->padlen+1; j<blen; j++) self->pad[j] = 0; |
161 | 161 | rv = [%lc_name%]_encrypt(self->pad, tmp_block, blen, &self->state); |
162 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_encrypt failed: %s", error_to_string(rv)); | |
162 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_encrypt failed: %s", error_to_string(rv)); | |
163 | 163 | } |
164 | 164 | else { |
165 | 165 | if (self->padlen>0) croak("FATAL: [%lc_name%]_encrypt, input data length not multiple of %d", blen); |
166 | 166 | blen = 0; |
167 | 167 | } |
168 | ||
168 | ||
169 | 169 | RETVAL = newSVpvn((char*)tmp_block, blen); |
170 | 170 | } |
171 | 171 | OUTPUT: |
190 | 190 | RETVAL = newSVpvn("", 0); |
191 | 191 | } |
192 | 192 | else { |
193 | ||
193 | ||
194 | 194 | if(self->padlen == blen) { |
195 | 195 | rv = [%lc_name%]_decrypt(self->pad, tmp_block, blen, &self->state); |
196 | 196 | if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_decrypt failed: %s", error_to_string(rv)); |
217 | 217 | in_data_len = 0; |
218 | 218 | } |
219 | 219 | } /* padlen > 0 */ |
220 | ||
220 | ||
221 | 221 | /* here: a/ padlen==1..16 && in_data_len==0; b/ padlen==0 && in_data_len>0 */ |
222 | 222 | if (in_data_len>0) { |
223 | 223 | i = (unsigned long)(in_data_len % blen); |
227 | 227 | in_data_len -= i; |
228 | 228 | } |
229 | 229 | } |
230 | ||
230 | ||
231 | 231 | if (in_data_len>0) { |
232 | 232 | if(self->padlen == 0 && self->padding_mode !=0) { |
233 | 233 | /* in case of padding keep full pad if no more data */ |
268 | 268 | _finish_dec(Crypt::Mode::[%orig_name%] self) |
269 | 269 | CODE: |
270 | 270 | { |
271 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
271 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
272 | 272 | unsigned char i; |
273 | 273 | int rv, rv_len, blen; |
274 | ||
275 | rv_len = 0; | |
274 | ||
275 | rv_len = 0; | |
276 | 276 | if (self->padlen > 0) { |
277 | 277 | blen = (&self->state)->blocklen; |
278 | 278 | if (self->padlen != blen) croak("FATAL: cipher text length has to be multiple of %d (%d)", blen, self->padlen); |
11 | 11 | my ($dir, $oldstring, $newstring) = @_; |
12 | 12 | my @files; |
13 | 13 | warn "replace: '$oldstring' > '$newstring'\n"; |
14 | find({ wanted=>sub { push @files, $_ if /\.c$/ }, no_chdir=>1 }, $dir); | |
14 | find({ wanted=>sub { push @files, $_ if /\.c$/ }, no_chdir=>1 }, $dir); | |
15 | 15 | #warn "replace: count=",scalar(@files),"\n"; |
16 | for my $m (sort @files) { | |
16 | for my $m (sort @files) { | |
17 | 17 | my $txt1 = read_file($m, binmode => ':utf8'); |
18 | 18 | my $txt2 = $txt1; |
19 | 19 | $txt2 =~ s/\Q$oldstring\E/$newstring/g; |
25 | 25 | sub remove_files { |
26 | 26 | my ($dir, $re) = @_; |
27 | 27 | my @files; |
28 | find({ wanted=>sub { push @files, $_ }, no_chdir=>1 }, $dir); | |
28 | find({ wanted=>sub { push @files, $_ }, no_chdir=>1 }, $dir); | |
29 | 29 | for my $m (sort @files) { |
30 | 30 | warn "unlink $m" if $m =~ $re; |
31 | 31 | unlink $m if $m =~ $re; |
58 | 58 | my (undef, undef, $file) = File::Spec->splitpath($src); |
59 | 59 | my $dst = "$src.inc"; |
60 | 60 | rename($src, $dst); |
61 | replace_text($srcdir, "$file\"", "$file.inc\""); | |
61 | replace_text($srcdir, "$file\"", "$file.inc\""); | |
62 | 62 | } |
63 | 63 | |
64 | 64 | remove_files($srcdir, qr/_test\.c$/); |
44 | 44 | |
45 | 45 | for my $n (keys %list) { |
46 | 46 | warn "Processing digest: '$n'\n"; |
47 | ||
47 | ||
48 | 48 | my $data = { |
49 | 49 | comment => "### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!", |
50 | 50 | orig_name => $n, |
55 | 55 | desc => $list{$n}->{desc}, |
56 | 56 | urls => $list{$n}->{urls}, |
57 | 57 | }; |
58 | ||
58 | ||
59 | 59 | if ($outdir_t) { |
60 | 60 | require Crypt::Digest; |
61 | 61 | Crypt::Digest::import(':all'); |
62 | 62 | for (@test_strings) { |
63 | push @{$data->{t_strings}}, { data=>pp($_), | |
64 | hex=>Crypt::Digest::digest_data_hex($n, $_), | |
63 | push @{$data->{t_strings}}, { data=>pp($_), | |
64 | hex=>Crypt::Digest::digest_data_hex($n, $_), | |
65 | 65 | base64=>Crypt::Digest::digest_data_b64($n, $_), |
66 | 66 | base64url=>Crypt::Digest::digest_data_b64u($n, $_), |
67 | 67 | }; |
69 | 69 | for (@test_files) { |
70 | 70 | $_ =~ s|\\|/|g; |
71 | 71 | push @{$data->{t_files}}, { file=>$_, |
72 | hex=>Crypt::Digest::digest_file_hex($n, "$FindBin::Bin/../$_"), | |
72 | hex=>Crypt::Digest::digest_file_hex($n, "$FindBin::Bin/../$_"), | |
73 | 73 | base64=>Crypt::Digest::digest_file_b64($n, "$FindBin::Bin/../$_"), |
74 | 74 | base64url=>Crypt::Digest::digest_file_b64u($n, "$FindBin::Bin/../$_"), |
75 | 75 | }; |
76 | } | |
76 | } | |
77 | 77 | $data->{t_files_count} = scalar(@{$data->{t_files}}); |
78 | 78 | $data->{t_strings_count} = scalar(@{$data->{t_strings}}); |
79 | 79 | $data->{hashsize} = Crypt::Digest->hashsize($n); |
84 | 84 | copy("$t_out.$$", $t_out) and warn("Writting '$t_out'\n") unless equal_files("$t_out.$$", $t_out); |
85 | 85 | unlink "$t_out.$$"; |
86 | 86 | } |
87 | ||
87 | ||
88 | 88 | if ($outdir_l) { |
89 | 89 | my $pm_out = catfile($outdir_l, "Crypt", "Digest", "$n.pm"); |
90 | 90 | my $pm_tt = Template->new(ABSOLUTE=>1) || die $Template::ERROR, "\n"; |
41 | 41 | info => $list{$n}->{info}, |
42 | 42 | urls => $list{$n}->{urls}, |
43 | 43 | }; |
44 | ||
44 | ||
45 | 45 | if($outdir_t) { |
46 | 46 | require Crypt::Mac::HMAC; |
47 | 47 | require Crypt::Mac::F9; |
73 | 73 | $_->{b64mac} = encode_base64(pack("H*", $_->{mac}),'') for (@{$data->{t_strings}}); |
74 | 74 | $_->{b64umac} = encode_base64url(pack("H*", $_->{mac}),'') for (@{$data->{t_strings}}); |
75 | 75 | $data->{t_strings_count} = defined $data->{t_strings} ? scalar(@{$data->{t_strings}}) : 0; |
76 | ||
76 | ||
77 | 77 | my $t_out = catfile($outdir_t, "mac_".lc($n).".t"); |
78 | 78 | my $t_tt = Template->new(ABSOLUTE=>1) || die $Template::ERROR, "\n"; |
79 | 79 | $t_tt->process("$FindBin::Bin/Mac.t.tt", $data, "$t_out.$$") || die $t_tt->error(), "\n"; |
80 | 80 | copy("$t_out.$$", $t_out) and warn("Writting '$t_out'\n") unless equal_files("$t_out.$$", $t_out); |
81 | 81 | unlink "$t_out.$$"; |
82 | 82 | } |
83 | ||
83 | ||
84 | 84 | if ($outdir_l) { |
85 | 85 | my $pm_out = catfile($outdir_l, "Crypt", "Mac", "$n.pm"); |
86 | 86 | my $pm_tt = Template->new(ABSOLUTE=>1) || die $Template::ERROR, "\n"; |
94 | 94 | copy("$xs_out.$$", $xs_out) and warn("Writting '$xs_out'\n") unless equal_files("$xs_out.$$", $xs_out); |
95 | 95 | unlink "$xs_out.$$"; |
96 | 96 | } |
97 | ||
97 | ||
98 | 98 | }⏎ |
19 | 19 | warn "STARTED: outdir_l='$outdir_l' outdir_t='$outdir_t'\n"; |
20 | 20 | |
21 | 21 | my %list = ( |
22 | CBC => { info=>'Block cipher mode CBC [Cipher-block chaining]', | |
22 | CBC => { info=>'Block cipher mode CBC [Cipher-block chaining]', | |
23 | 23 | desc=>"This module implements CBC cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN).", |
24 | 24 | url=>'https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29', |
25 | 25 | }, |
26 | CFB => { info=>'Block cipher mode CFB [Cipher feedback]', | |
26 | CFB => { info=>'Block cipher mode CFB [Cipher feedback]', | |
27 | 27 | desc=>"This module implements CFB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN).", |
28 | 28 | url=>'https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_feedback_.28CFB.29', |
29 | 29 | }, |
30 | CTR => { info=>'Block cipher mode CTR [Counter mode]', | |
30 | CTR => { info=>'Block cipher mode CTR [Counter mode]', | |
31 | 31 | desc=>"This module implements CTR cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN).", |
32 | 32 | url=>'https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_.28CTR.29', |
33 | 33 | }, |
34 | ECB => { info=>'Block cipher mode ECB [Electronic codebook]', | |
34 | ECB => { info=>'Block cipher mode ECB [Electronic codebook]', | |
35 | 35 | desc=>"This module implements ECB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN).\n". |
36 | 36 | "BEWARE: ECB is inherently insecure, if you are not sure go for L<Crypt::Mode::CBC>!", |
37 | 37 | url=>'https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_.28ECB.29', |
38 | 38 | }, |
39 | OFB => { info=>'Block cipher mode OFB [Output feedback]', | |
39 | OFB => { info=>'Block cipher mode OFB [Output feedback]', | |
40 | 40 | desc=>"This module implements OFB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN).", |
41 | 41 | url=>'https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Output_feedback_.28OFB.29', |
42 | 42 | }, |
43 | # F8 => { info=>'Block cipher mode F8', | |
43 | # F8 => { info=>'Block cipher mode F8', | |
44 | 44 | # desc=>q[xxx-desc-goes here]}, |
45 | # LRW => { info=>'Block cipher mode LRW [Liskov, Rivest, Wagner]', | |
45 | # LRW => { info=>'Block cipher mode LRW [Liskov, Rivest, Wagner]', | |
46 | 46 | # desc=>q[xxx-desc-goes here]}, |
47 | # XTS => { info=>'Block cipher mode XTS [XEX-based tweaked-codebook mode with ciphertext stealing]', | |
47 | # XTS => { info=>'Block cipher mode XTS [XEX-based tweaked-codebook mode with ciphertext stealing]', | |
48 | 48 | # desc=>q[xxx-desc-goes here]}, |
49 | 49 | ); |
50 | 50 | |
59 | 59 | info => $list{$n}->{info}, |
60 | 60 | desc => $list{$n}->{desc}, |
61 | 61 | }; |
62 | ||
62 | ||
63 | 63 | if ($outdir_t) { |
64 | 64 | #require Crypt::... |
65 | 65 | |
72 | 72 | |
73 | 73 | if ($outdir_l) { |
74 | 74 | if (1) { # if($n ne 'CBC' || $n ne 'ECB') { |
75 | my $xs_out = catfile($outdir_l, "CryptX_Mode_$n.xs.inc"); | |
75 | my $xs_out = catfile($outdir_l, "CryptX_Mode_$n.xs.inc"); | |
76 | 76 | my $xs_tt = Template->new(ABSOLUTE=>1) || die $Template::ERROR, "\n"; |
77 | 77 | if ($n eq 'CBC' || $n eq 'ECB') { |
78 | 78 | $xs_tt->process("$FindBin::Bin/Mode_p.xs.inc.tt", $data, "$xs_out.$$") || die $xs_tt->error(), "\n"; |
83 | 83 | copy("$xs_out.$$", $xs_out) and warn("Writting '$xs_out'\n") unless equal_files("$xs_out.$$", $xs_out); |
84 | 84 | unlink "$xs_out.$$"; |
85 | 85 | } |
86 | ||
86 | ||
87 | 87 | my $pm_out = catfile($outdir_l, "Crypt", "Mode", "$n.pm"); |
88 | 88 | my $pm_tt = Template->new(ABSOLUTE=>1) || die $Template::ERROR, "\n"; |
89 | 89 | $pm_tt->process("$FindBin::Bin/Mode.pm.tt", $data, "$pm_out.$$") || die $pm_tt->error(), "\n"; |
0 | package Crypt::Cipher::AES; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::AES - Symetric cipher AES (aka Rijndael), key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('AES'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::AES; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::AES', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the AES cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::AES->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::AES->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::AES->keysize; | |
72 | #or | |
73 | Crypt::Cipher::AES::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::AES->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::AES::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::AES->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::AES::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::AES->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::AES::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::AES->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::AES::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Advanced_Encryption_Standard|http://en.wikipedia.org/wiki/Advanced_Encryption_Standard> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::AES; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::AES - Symetric cipher AES (aka Rijndael), key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('AES'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::AES; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::AES', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the AES cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::AES->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::AES->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::AES->keysize; | |
72 | #or | |
73 | Crypt::Cipher::AES::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::AES->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::AES::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::AES->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::AES::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::AES->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::AES::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::AES->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::AES::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Advanced_Encryption_Standard|http://en.wikipedia.org/wiki/Advanced_Encryption_Standard> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Anubis; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Anubis - Symetric cipher Anubis, key size: 128-320 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Anubis'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Anubis; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Anubis', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Anubis cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Anubis->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Anubis->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Anubis->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Anubis::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Anubis->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Anubis::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Anubis->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Anubis::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Anubis->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Anubis::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Anubis->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Anubis::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Anubis_(cipher)|http://en.wikipedia.org/wiki/Anubis_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Anubis; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Anubis - Symetric cipher Anubis, key size: 128-320 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Anubis'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Anubis; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Anubis', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Anubis cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Anubis->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Anubis->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Anubis->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Anubis::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Anubis->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Anubis::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Anubis->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Anubis::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Anubis->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Anubis::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Anubis->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Anubis::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Anubis_(cipher)|http://en.wikipedia.org/wiki/Anubis_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Blowfish; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Blowfish - Symetric cipher Blowfish, key size: 64-448 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Blowfish'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Blowfish; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Blowfish', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Blowfish cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Blowfish->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Blowfish->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Blowfish->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Blowfish::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Blowfish->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Blowfish::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Blowfish->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Blowfish::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Blowfish->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Blowfish::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Blowfish->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Blowfish::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Blowfish_(cipher)|http://en.wikipedia.org/wiki/Blowfish_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Blowfish; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Blowfish - Symetric cipher Blowfish, key size: 64-448 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Blowfish'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Blowfish; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Blowfish', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Blowfish cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Blowfish->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Blowfish->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Blowfish->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Blowfish::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Blowfish->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Blowfish::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Blowfish->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Blowfish::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Blowfish->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Blowfish::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Blowfish->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Blowfish::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Blowfish_(cipher)|http://en.wikipedia.org/wiki/Blowfish_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::CAST5; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::CAST5 - Symetric cipher CAST5 (aka CAST-128), key size: 40-128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('CAST5'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::CAST5; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::CAST5', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the CAST5 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::CAST5->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::CAST5->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::CAST5->keysize; | |
72 | #or | |
73 | Crypt::Cipher::CAST5::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::CAST5->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::CAST5::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::CAST5->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::CAST5::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::CAST5->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::CAST5::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::CAST5->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::CAST5::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/CAST-128|http://en.wikipedia.org/wiki/CAST-128> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::CAST5; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::CAST5 - Symetric cipher CAST5 (aka CAST-128), key size: 40-128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('CAST5'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::CAST5; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::CAST5', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the CAST5 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::CAST5->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::CAST5->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::CAST5->keysize; | |
72 | #or | |
73 | Crypt::Cipher::CAST5::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::CAST5->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::CAST5::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::CAST5->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::CAST5::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::CAST5->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::CAST5::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::CAST5->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::CAST5::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/CAST-128|http://en.wikipedia.org/wiki/CAST-128> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Camellia; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Camellia - Symetric cipher Camellia, key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Camellia'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Camellia; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Camellia', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Camellia cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Camellia->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Camellia->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Camellia->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Camellia::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Camellia->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Camellia::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Camellia->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Camellia::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Camellia->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Camellia::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Camellia->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Camellia::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Camellia_(cipher)|http://en.wikipedia.org/wiki/Camellia_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Camellia; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Camellia - Symetric cipher Camellia, key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Camellia'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Camellia; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Camellia', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Camellia cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Camellia->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Camellia->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Camellia->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Camellia::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Camellia->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Camellia::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Camellia->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Camellia::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Camellia->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Camellia::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Camellia->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Camellia::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Camellia_(cipher)|http://en.wikipedia.org/wiki/Camellia_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::DES; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::DES - Symetric cipher DES, key size: 64[56] bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('DES'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::DES; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the DES cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::DES->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::DES->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::DES->keysize; | |
72 | #or | |
73 | Crypt::Cipher::DES::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::DES->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::DES::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::DES->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::DES::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::DES->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::DES::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::DES->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::DES::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Data_Encryption_Standard|http://en.wikipedia.org/wiki/Data_Encryption_Standard> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::DES; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::DES - Symetric cipher DES, key size: 64[56] bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('DES'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::DES; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the DES cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::DES->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::DES->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::DES->keysize; | |
72 | #or | |
73 | Crypt::Cipher::DES::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::DES->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::DES::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::DES->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::DES::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::DES->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::DES::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::DES->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::DES::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Data_Encryption_Standard|http://en.wikipedia.org/wiki/Data_Encryption_Standard> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::DES_EDE; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::DES_EDE - Symetric cipher DES_EDE (aka Tripple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('DES_EDE'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::DES_EDE; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES_EDE', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the DES_EDE cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::DES_EDE->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::DES_EDE->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::DES_EDE->keysize; | |
72 | #or | |
73 | Crypt::Cipher::DES_EDE::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::DES_EDE->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::DES_EDE::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::DES_EDE->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::DES_EDE::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::DES_EDE->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::DES_EDE::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::DES_EDE->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::DES_EDE::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Triple_DES|http://en.wikipedia.org/wiki/Triple_DES> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::DES_EDE; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::DES_EDE - Symetric cipher DES_EDE (aka Tripple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('DES_EDE'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::DES_EDE; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES_EDE', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the DES_EDE cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::DES_EDE->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::DES_EDE->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::DES_EDE->keysize; | |
72 | #or | |
73 | Crypt::Cipher::DES_EDE::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::DES_EDE->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::DES_EDE::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::DES_EDE->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::DES_EDE::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::DES_EDE->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::DES_EDE::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::DES_EDE->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::DES_EDE::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Triple_DES|http://en.wikipedia.org/wiki/Triple_DES> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::KASUMI; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::KASUMI - Symetric cipher KASUMI, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('KASUMI'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::KASUMI; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::KASUMI', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the KASUMI cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::KASUMI->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::KASUMI->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::KASUMI->keysize; | |
72 | #or | |
73 | Crypt::Cipher::KASUMI::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::KASUMI->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::KASUMI::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::KASUMI->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::KASUMI::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::KASUMI->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::KASUMI::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::KASUMI->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::KASUMI::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/KASUMI_(block_cipher)|http://en.wikipedia.org/wiki/KASUMI_(block_cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::KASUMI; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::KASUMI - Symetric cipher KASUMI, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('KASUMI'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::KASUMI; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::KASUMI', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the KASUMI cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::KASUMI->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::KASUMI->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::KASUMI->keysize; | |
72 | #or | |
73 | Crypt::Cipher::KASUMI::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::KASUMI->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::KASUMI::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::KASUMI->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::KASUMI::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::KASUMI->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::KASUMI::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::KASUMI->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::KASUMI::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/KASUMI_(block_cipher)|http://en.wikipedia.org/wiki/KASUMI_(block_cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Khazad; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Khazad - Symetric cipher Khazad, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Khazad'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Khazad; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Khazad', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Khazad cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Khazad->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Khazad->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Khazad->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Khazad::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Khazad->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Khazad::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Khazad->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Khazad::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Khazad->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Khazad::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Khazad->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Khazad::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/KHAZAD|http://en.wikipedia.org/wiki/KHAZAD> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Khazad; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Khazad - Symetric cipher Khazad, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Khazad'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Khazad; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Khazad', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Khazad cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Khazad->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Khazad->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Khazad->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Khazad::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Khazad->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Khazad::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Khazad->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Khazad::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Khazad->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Khazad::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Khazad->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Khazad::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/KHAZAD|http://en.wikipedia.org/wiki/KHAZAD> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::MULTI2; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::MULTI2 - Symetric cipher MULTI2, key size: 320 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('MULTI2'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::MULTI2; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::MULTI2', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the MULTI2 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::MULTI2->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::MULTI2->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::MULTI2->keysize; | |
72 | #or | |
73 | Crypt::Cipher::MULTI2::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::MULTI2->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::MULTI2::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::MULTI2->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::MULTI2::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::MULTI2->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::MULTI2::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::MULTI2->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::MULTI2::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/MULTI2|http://en.wikipedia.org/wiki/MULTI2> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::MULTI2; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::MULTI2 - Symetric cipher MULTI2, key size: 320 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('MULTI2'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::MULTI2; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::MULTI2', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the MULTI2 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::MULTI2->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::MULTI2->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::MULTI2->keysize; | |
72 | #or | |
73 | Crypt::Cipher::MULTI2::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::MULTI2->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::MULTI2::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::MULTI2->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::MULTI2::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::MULTI2->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::MULTI2::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::MULTI2->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::MULTI2::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/MULTI2|http://en.wikipedia.org/wiki/MULTI2> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Noekeon; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Noekeon - Symetric cipher Noekeon, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Noekeon'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Noekeon; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Noekeon', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Noekeon cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Noekeon->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Noekeon->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Noekeon->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Noekeon::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Noekeon->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Noekeon::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Noekeon->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Noekeon::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Noekeon->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Noekeon::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Noekeon->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Noekeon::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/NOEKEON|http://en.wikipedia.org/wiki/NOEKEON> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Noekeon; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Noekeon - Symetric cipher Noekeon, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Noekeon'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Noekeon; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Noekeon', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Noekeon cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Noekeon->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Noekeon->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Noekeon->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Noekeon::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Noekeon->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Noekeon::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Noekeon->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Noekeon::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Noekeon->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Noekeon::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Noekeon->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Noekeon::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/NOEKEON|http://en.wikipedia.org/wiki/NOEKEON> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::RC2; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::RC2 - Symetric cipher RC2, key size: 64-1024 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('RC2'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::RC2; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC2', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the RC2 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::RC2->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::RC2->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::RC2->keysize; | |
72 | #or | |
73 | Crypt::Cipher::RC2::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::RC2->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::RC2::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::RC2->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::RC2::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::RC2->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::RC2::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::RC2->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::RC2::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/RC2|http://en.wikipedia.org/wiki/RC2> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::RC2; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::RC2 - Symetric cipher RC2, key size: 64-1024 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('RC2'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::RC2; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC2', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the RC2 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::RC2->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::RC2->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::RC2->keysize; | |
72 | #or | |
73 | Crypt::Cipher::RC2::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::RC2->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::RC2::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::RC2->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::RC2::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::RC2->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::RC2::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::RC2->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::RC2::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/RC2|http://en.wikipedia.org/wiki/RC2> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::RC5; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::RC5 - Symetric cipher RC5, key size: 64-1024 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('RC5'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::RC5; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC5', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the RC5 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::RC5->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::RC5->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::RC5->keysize; | |
72 | #or | |
73 | Crypt::Cipher::RC5::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::RC5->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::RC5::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::RC5->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::RC5::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::RC5->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::RC5::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::RC5->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::RC5::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/RC5|http://en.wikipedia.org/wiki/RC5> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::RC5; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::RC5 - Symetric cipher RC5, key size: 64-1024 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('RC5'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::RC5; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC5', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the RC5 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::RC5->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::RC5->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::RC5->keysize; | |
72 | #or | |
73 | Crypt::Cipher::RC5::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::RC5->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::RC5::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::RC5->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::RC5::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::RC5->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::RC5::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::RC5->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::RC5::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/RC5|http://en.wikipedia.org/wiki/RC5> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::RC6; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::RC6 - Symetric cipher RC6, key size: 64-1024 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('RC6'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::RC6; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC6', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the RC6 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::RC6->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::RC6->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::RC6->keysize; | |
72 | #or | |
73 | Crypt::Cipher::RC6::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::RC6->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::RC6::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::RC6->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::RC6::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::RC6->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::RC6::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::RC6->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::RC6::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/RC6|http://en.wikipedia.org/wiki/RC6> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::RC6; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::RC6 - Symetric cipher RC6, key size: 64-1024 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('RC6'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::RC6; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC6', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the RC6 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::RC6->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::RC6->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::RC6->keysize; | |
72 | #or | |
73 | Crypt::Cipher::RC6::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::RC6->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::RC6::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::RC6->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::RC6::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::RC6->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::RC6::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::RC6->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::RC6::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/RC6|http://en.wikipedia.org/wiki/RC6> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::SAFERP; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFERP - Symetric cipher SAFER+, key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFERP'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFERP; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFERP', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFERP cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFERP->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFERP->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFERP->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFERP::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFERP->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFERP::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFERP->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFERP::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFERP->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFERP::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFERP->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFERP::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::SAFERP; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFERP - Symetric cipher SAFER+, key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFERP'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFERP; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFERP', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFERP cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFERP->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFERP->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFERP->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFERP::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFERP->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFERP::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFERP->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFERP::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFERP->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFERP::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFERP->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFERP::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::SAFER_K128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_K128 - Symetric cipher SAFER_K128, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_K128'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_K128; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K128', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_K128 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_K128->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_K128->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_K128->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_K128::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_K128->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_K128::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_K128->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_K128::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_K128->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_K128::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_K128->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_K128::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::SAFER_K128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_K128 - Symetric cipher SAFER_K128, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_K128'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_K128; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K128', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_K128 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_K128->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_K128->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_K128->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_K128::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_K128->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_K128::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_K128->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_K128::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_K128->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_K128::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_K128->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_K128::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::SAFER_K64; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_K64 - Symetric cipher SAFER_K64, key size: 64 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_K64'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_K64; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K64', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_K64 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_K64->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_K64->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_K64->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_K64::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_K64->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_K64::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_K64->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_K64::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_K64->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_K64::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_K64->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_K64::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::SAFER_K64; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_K64 - Symetric cipher SAFER_K64, key size: 64 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_K64'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_K64; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K64', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_K64 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_K64->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_K64->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_K64->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_K64::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_K64->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_K64::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_K64->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_K64::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_K64->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_K64::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_K64->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_K64::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::SAFER_SK128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_SK128 - Symetric cipher SAFER_SK128, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_SK128'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_SK128; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK128', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_SK128 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_SK128->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_SK128->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_SK128->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_SK128::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_SK128->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_SK128::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_SK128->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_SK128::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_SK128->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_SK128::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_SK128->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_SK128::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::SAFER_SK128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_SK128 - Symetric cipher SAFER_SK128, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_SK128'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_SK128; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK128', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_SK128 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_SK128->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_SK128->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_SK128->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_SK128::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_SK128->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_SK128::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_SK128->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_SK128::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_SK128->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_SK128::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_SK128->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_SK128::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::SAFER_SK64; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_SK64 - Symetric cipher SAFER_SK64, key size: 64 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_SK64'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_SK64; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK64', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_SK64 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_SK64->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_SK64->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_SK64->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_SK64::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_SK64->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_SK64::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_SK64->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_SK64::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_SK64->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_SK64::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_SK64->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_SK64::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::SAFER_SK64; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SAFER_SK64 - Symetric cipher SAFER_SK64, key size: 64 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SAFER_SK64'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SAFER_SK64; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK64', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SAFER_SK64 cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SAFER_SK64->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SAFER_SK64->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SAFER_SK64->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SAFER_SK64::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SAFER_SK64->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SAFER_SK64::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SAFER_SK64->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SAFER_SK64::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SAFER_SK64->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SAFER_SK64::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SAFER_SK64->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SAFER_SK64::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SAFER|http://en.wikipedia.org/wiki/SAFER> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::SEED; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SEED - Symetric cipher SEED, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SEED'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SEED; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SEED', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SEED cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SEED->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SEED->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SEED->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SEED::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SEED->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SEED::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SEED->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SEED::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SEED->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SEED::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SEED->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SEED::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SEED|http://en.wikipedia.org/wiki/SEED> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::SEED; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::SEED - Symetric cipher SEED, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('SEED'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::SEED; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SEED', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the SEED cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::SEED->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::SEED->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::SEED->keysize; | |
72 | #or | |
73 | Crypt::Cipher::SEED::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::SEED->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::SEED::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::SEED->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::SEED::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::SEED->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::SEED::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::SEED->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::SEED::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/SEED|http://en.wikipedia.org/wiki/SEED> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Skipjack; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Skipjack - Symetric cipher Skipjack, key size: 80 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Skipjack'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Skipjack; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Skipjack', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Skipjack cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Skipjack->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Skipjack->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Skipjack->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Skipjack::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Skipjack->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Skipjack::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Skipjack->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Skipjack::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Skipjack->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Skipjack::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Skipjack->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Skipjack::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Skipjack_(cipher)|http://en.wikipedia.org/wiki/Skipjack_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Skipjack; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Skipjack - Symetric cipher Skipjack, key size: 80 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Skipjack'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Skipjack; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Skipjack', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Skipjack cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Skipjack->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Skipjack->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Skipjack->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Skipjack::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Skipjack->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Skipjack::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Skipjack->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Skipjack::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Skipjack->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Skipjack::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Skipjack->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Skipjack::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Skipjack_(cipher)|http://en.wikipedia.org/wiki/Skipjack_(cipher)> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::Twofish; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Twofish - Symetric cipher Twofish, key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Twofish'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Twofish; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Twofish', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Twofish cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Twofish->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Twofish->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Twofish->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Twofish::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Twofish->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Twofish::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Twofish->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Twofish::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Twofish->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Twofish::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Twofish->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Twofish::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Twofish|http://en.wikipedia.org/wiki/Twofish> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::Twofish; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::Twofish - Symetric cipher Twofish, key size: 128/192/256 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('Twofish'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::Twofish; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Twofish', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the Twofish cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::Twofish->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::Twofish->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::Twofish->keysize; | |
72 | #or | |
73 | Crypt::Cipher::Twofish::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::Twofish->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::Twofish::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::Twofish->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::Twofish::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::Twofish->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::Twofish::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::Twofish->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::Twofish::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/Twofish|http://en.wikipedia.org/wiki/Twofish> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
0 | package Crypt::Cipher::XTEA; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::XTEA - Symetric cipher XTEA, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('XTEA'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::XTEA; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::XTEA', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the XTEA cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::XTEA->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::XTEA->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::XTEA->keysize; | |
72 | #or | |
73 | Crypt::Cipher::XTEA::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::XTEA->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::XTEA::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::XTEA->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::XTEA::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::XTEA->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::XTEA::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::XTEA->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::XTEA::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over 4 | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/XTEA|http://en.wikipedia.org/wiki/XTEA> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
0 | package Crypt::Cipher::XTEA; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use CryptX; | |
8 | use base 'Crypt::Cipher'; | |
9 | ||
10 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } | |
11 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } | |
12 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } | |
13 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } | |
14 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } | |
15 | ||
16 | 1; | |
17 | ||
18 | =pod | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | Crypt::Cipher::XTEA - Symetric cipher XTEA, key size: 128 bits (Crypt::CBC compliant) | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | ### example 1 | |
27 | use Crypt::Mode::CBC; | |
28 | ||
29 | my $key = '...'; # length has to be valid key size for this cipher | |
30 | my $iv = '...'; # 16 bytes | |
31 | my $cbc = Crypt::Mode::CBC->new('XTEA'); | |
32 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
33 | ||
34 | ### example 2 | |
35 | use Crypt::CBC; | |
36 | use Crypt::Cipher::XTEA; | |
37 | ||
38 | my $key = '...'; # length has to be valid key size for this cipher | |
39 | my $iv = '...'; # 16 bytes | |
40 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::XTEA', -key=>$key, -iv=>$iv ); | |
41 | my $ciphertext = $cbc->encrypt("secret data"); | |
42 | ||
43 | =head1 DESCRIPTION | |
44 | ||
45 | This module implements the XTEA cipher. Provided interface is compliant with L<Crypt::CBC|Crypt::CBC> module. | |
46 | ||
47 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
48 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
49 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CTR|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
50 | ||
51 | =head1 METHODS | |
52 | ||
53 | =head2 new | |
54 | ||
55 | $c = Crypt::Cipher::XTEA->new($key); | |
56 | #or | |
57 | $c = Crypt::Cipher::XTEA->new($key, $rounds); | |
58 | ||
59 | =head2 encrypt | |
60 | ||
61 | $ciphertext = $c->encrypt($plaintext); | |
62 | ||
63 | =head2 decrypt | |
64 | ||
65 | $plaintext = $c->decrypt($ciphertext); | |
66 | ||
67 | =head2 keysize | |
68 | ||
69 | $c->keysize; | |
70 | #or | |
71 | Crypt::Cipher::XTEA->keysize; | |
72 | #or | |
73 | Crypt::Cipher::XTEA::keysize; | |
74 | ||
75 | =head2 blocksize | |
76 | ||
77 | $c->blocksize; | |
78 | #or | |
79 | Crypt::Cipher::XTEA->blocksize; | |
80 | #or | |
81 | Crypt::Cipher::XTEA::blocksize; | |
82 | ||
83 | =head2 max_keysize | |
84 | ||
85 | $c->max_keysize; | |
86 | #or | |
87 | Crypt::Cipher::XTEA->max_keysize; | |
88 | #or | |
89 | Crypt::Cipher::XTEA::max_keysize; | |
90 | ||
91 | =head2 min_keysize | |
92 | ||
93 | $c->min_keysize; | |
94 | #or | |
95 | Crypt::Cipher::XTEA->min_keysize; | |
96 | #or | |
97 | Crypt::Cipher::XTEA::min_keysize; | |
98 | ||
99 | =head2 default_rounds | |
100 | ||
101 | $c->default_rounds; | |
102 | #or | |
103 | Crypt::Cipher::XTEA->default_rounds; | |
104 | #or | |
105 | Crypt::Cipher::XTEA::default_rounds; | |
106 | ||
107 | =head1 SEE ALSO | |
108 | ||
109 | =over | |
110 | ||
111 | =item L<CryptX|CryptX>, L<Crypt::Cipher|Crypt::Cipher> | |
112 | ||
113 | =item L<http://en.wikipedia.org/wiki/XTEA|http://en.wikipedia.org/wiki/XTEA> | |
114 | ||
115 | =back | |
116 | ||
117 | =cut | |
118 | ||
119 | 119 | __END__⏎ |
90 | 90 | |
91 | 91 | =head1 SYNOPSIS |
92 | 92 | |
93 | #### example 1 | |
93 | #### example 1 (encrypting single block) | |
94 | 94 | use Crypt::Cipher; |
95 | 95 | |
96 | $key = 'K' x 32; # 256 bits | |
97 | $c = Crypt::Cipher->new('AES', $key); | |
98 | $blocksize = $c->blocksize; | |
99 | $ciphertext = $c->encrypt('plain text block'); #encrypt 1 block | |
100 | $plaintext = $c->decrypt($ciphertext); #decrypt 1 block | |
101 | ||
102 | #### example 2 (compatibility with Crypt::CBC) | |
96 | my $key = '...'; # length has to be valid key size for this cipher | |
97 | my $c = Crypt::Cipher->new('AES', $key); | |
98 | my $blocksize = $c->blocksize; | |
99 | my $ciphertext = $c->encrypt('plain text block'); #encrypt 1 block | |
100 | my $plaintext = $c->decrypt($ciphertext); #decrypt 1 block | |
101 | ||
102 | ### example 2 (using CBC mode) | |
103 | use Crypt::Mode::CBC; | |
104 | ||
105 | my $key = '...'; # length has to be valid key size for this cipher | |
106 | my $iv = '...'; # 16 bytes | |
107 | my $cbc = Crypt::Mode::CBC->new('AES'); | |
108 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); | |
109 | ||
110 | #### example 3 (compatibility with Crypt::CBC) | |
103 | 111 | use Crypt::CBC; |
104 | 112 | use Crypt::Cipher; |
105 | 113 | |
106 | 114 | my $key = '...'; # length has to be valid key size for this cipher |
115 | my $iv = '...'; # 16 bytes | |
107 | 116 | my $cipher = Crypt::Cipher('AES', $key); |
108 | my $cbc = Crypt::CBC->new( -cipher=>$cipher ); | |
117 | my $cbc = Crypt::CBC->new( -cipher=>$cipher, -iv=>$iv ); | |
109 | 118 | my $ciphertext = $cbc->encrypt("secret data"); |
110 | 119 | |
111 | 120 | =head1 DESCRIPTION |
112 | 121 | |
113 | 122 | Provides an interface to various symetric cipher algorithms. |
114 | 123 | |
115 | B<BEWARE:> This module implements just elementary one-block (usually 8 or 16 byte) encryption/encryption | |
116 | operation - if you want to encrypt/decrypt generic data of "any length" you have to use some of the cipher | |
117 | block modes - check for example L<Crypt::Mode::CBC|Crypt::Mode::CBC>. | |
124 | B<BEWARE:> This module implements just elementary "one-block-(en|de)cryption" operation - if you want to | |
125 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example | |
126 | L<Crypt::Mode::CBC|Crypt::Mode::CBC>, L<Crypt::Mode::CBC|Crypt::Mode::CTR> or L<Crypt::CBC|Crypt::CBC>. | |
118 | 127 | |
119 | 128 | =head1 METHODS |
120 | 129 | |
193 | 202 | |
194 | 203 | =head1 SEE ALSO |
195 | 204 | |
196 | =over 4 | |
205 | =over | |
197 | 206 | |
198 | 207 | =item L<CryptX|CryptX> |
199 | 208 |
0 | package Crypt::Digest::CHAES; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( chaes chaes_hex chaes_b64 chaes_b64u chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub chaes { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub chaes_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub chaes_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub chaes_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub chaes_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub chaes_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub chaes_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub chaes_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::CHAES - Hash function - CipherHash based on AES [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::CHAES qw( chaes chaes_hex chaes_b64 chaes_b64u | |
41 | chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $chaes_raw = chaes('data string'); | |
45 | $chaes_hex = chaes_hex('data string'); | |
46 | $chaes_b64 = chaes_b64('data string'); | |
47 | $chaes_b64u = chaes_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $chaes_raw = chaes_file('filename.dat'); | |
50 | $chaes_hex = chaes_file_hex('filename.dat'); | |
51 | $chaes_b64 = chaes_file_b64('filename.dat'); | |
52 | $chaes_b64u = chaes_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $chaes_raw = chaes_file(*FILEHANDLE); | |
55 | $chaes_hex = chaes_file_hex(*FILEHANDLE); | |
56 | $chaes_b64 = chaes_file_b64(*FILEHANDLE); | |
57 | $chaes_b64u = chaes_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::CHAES; | |
61 | ||
62 | $d = Crypt::Digest::CHAES->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the CHAES digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::CHAES qw(chaes chaes_hex chaes_b64 chaes_b64u | |
82 | chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::CHAES ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 chaes | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a binary string. | |
93 | ||
94 | $chaes_raw = chaes('data string'); | |
95 | #or | |
96 | $chaes_raw = chaes('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 chaes_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a hexadecimal string. | |
101 | ||
102 | $chaes_hex = chaes_hex('data string'); | |
103 | #or | |
104 | $chaes_hex = chaes_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 chaes_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $chaes_b64 = chaes_b64('data string'); | |
111 | #or | |
112 | $chaes_b64 = chaes_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 chaes_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $chaes_b64url = chaes_b64u('data string'); | |
119 | #or | |
120 | $chaes_b64url = chaes_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 chaes_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a binary string. | |
125 | ||
126 | $chaes_raw = chaes_file('filename.dat'); | |
127 | #or | |
128 | $chaes_raw = chaes_file(*FILEHANDLE); | |
129 | ||
130 | =head2 chaes_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a hexadecimal string. | |
133 | ||
134 | $chaes_hex = chaes_file_hex('filename.dat'); | |
135 | #or | |
136 | $chaes_hex = chaes_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 chaes_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $chaes_b64 = chaes_file_b64('filename.dat'); | |
145 | #or | |
146 | $chaes_b64 = chaes_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 chaes_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $chaes_b64url = chaes_file_b64u('filename.dat'); | |
153 | #or | |
154 | $chaes_b64url = chaes_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::CHAES->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::CHAES->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::CHAES::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers|http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::CHAES; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( chaes chaes_hex chaes_b64 chaes_b64u chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub chaes { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub chaes_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub chaes_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub chaes_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub chaes_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub chaes_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub chaes_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub chaes_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::CHAES - Hash function - CipherHash based on AES [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::CHAES qw( chaes chaes_hex chaes_b64 chaes_b64u | |
41 | chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $chaes_raw = chaes('data string'); | |
45 | $chaes_hex = chaes_hex('data string'); | |
46 | $chaes_b64 = chaes_b64('data string'); | |
47 | $chaes_b64u = chaes_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $chaes_raw = chaes_file('filename.dat'); | |
50 | $chaes_hex = chaes_file_hex('filename.dat'); | |
51 | $chaes_b64 = chaes_file_b64('filename.dat'); | |
52 | $chaes_b64u = chaes_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $chaes_raw = chaes_file(*FILEHANDLE); | |
55 | $chaes_hex = chaes_file_hex(*FILEHANDLE); | |
56 | $chaes_b64 = chaes_file_b64(*FILEHANDLE); | |
57 | $chaes_b64u = chaes_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::CHAES; | |
61 | ||
62 | $d = Crypt::Digest::CHAES->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the CHAES digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::CHAES qw(chaes chaes_hex chaes_b64 chaes_b64u | |
82 | chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::CHAES ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 chaes | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a binary string. | |
93 | ||
94 | $chaes_raw = chaes('data string'); | |
95 | #or | |
96 | $chaes_raw = chaes('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 chaes_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a hexadecimal string. | |
101 | ||
102 | $chaes_hex = chaes_hex('data string'); | |
103 | #or | |
104 | $chaes_hex = chaes_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 chaes_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $chaes_b64 = chaes_b64('data string'); | |
111 | #or | |
112 | $chaes_b64 = chaes_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 chaes_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its CHAES digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $chaes_b64url = chaes_b64u('data string'); | |
119 | #or | |
120 | $chaes_b64url = chaes_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 chaes_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a binary string. | |
125 | ||
126 | $chaes_raw = chaes_file('filename.dat'); | |
127 | #or | |
128 | $chaes_raw = chaes_file(*FILEHANDLE); | |
129 | ||
130 | =head2 chaes_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a hexadecimal string. | |
133 | ||
134 | $chaes_hex = chaes_file_hex('filename.dat'); | |
135 | #or | |
136 | $chaes_hex = chaes_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 chaes_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $chaes_b64 = chaes_file_b64('filename.dat'); | |
145 | #or | |
146 | $chaes_b64 = chaes_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 chaes_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its CHAES digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $chaes_b64url = chaes_file_b64u('filename.dat'); | |
153 | #or | |
154 | $chaes_b64url = chaes_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::CHAES->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::CHAES->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::CHAES::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers|http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::MD2; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( md2 md2_hex md2_b64 md2_b64u md2_file md2_file_hex md2_file_b64 md2_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub md2 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub md2_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub md2_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub md2_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub md2_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub md2_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub md2_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub md2_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::MD2 - Hash function MD2 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::MD2 qw( md2 md2_hex md2_b64 md2_b64u | |
41 | md2_file md2_file_hex md2_file_b64 md2_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $md2_raw = md2('data string'); | |
45 | $md2_hex = md2_hex('data string'); | |
46 | $md2_b64 = md2_b64('data string'); | |
47 | $md2_b64u = md2_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $md2_raw = md2_file('filename.dat'); | |
50 | $md2_hex = md2_file_hex('filename.dat'); | |
51 | $md2_b64 = md2_file_b64('filename.dat'); | |
52 | $md2_b64u = md2_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $md2_raw = md2_file(*FILEHANDLE); | |
55 | $md2_hex = md2_file_hex(*FILEHANDLE); | |
56 | $md2_b64 = md2_file_b64(*FILEHANDLE); | |
57 | $md2_b64u = md2_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::MD2; | |
61 | ||
62 | $d = Crypt::Digest::MD2->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the MD2 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::MD2 qw(md2 md2_hex md2_b64 md2_b64u | |
82 | md2_file md2_file_hex md2_file_b64 md2_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::MD2 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 md2 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a binary string. | |
93 | ||
94 | $md2_raw = md2('data string'); | |
95 | #or | |
96 | $md2_raw = md2('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 md2_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a hexadecimal string. | |
101 | ||
102 | $md2_hex = md2_hex('data string'); | |
103 | #or | |
104 | $md2_hex = md2_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 md2_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $md2_b64 = md2_b64('data string'); | |
111 | #or | |
112 | $md2_b64 = md2_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 md2_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $md2_b64url = md2_b64u('data string'); | |
119 | #or | |
120 | $md2_b64url = md2_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 md2_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a binary string. | |
125 | ||
126 | $md2_raw = md2_file('filename.dat'); | |
127 | #or | |
128 | $md2_raw = md2_file(*FILEHANDLE); | |
129 | ||
130 | =head2 md2_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a hexadecimal string. | |
133 | ||
134 | $md2_hex = md2_file_hex('filename.dat'); | |
135 | #or | |
136 | $md2_hex = md2_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 md2_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $md2_b64 = md2_file_b64('filename.dat'); | |
145 | #or | |
146 | $md2_b64 = md2_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 md2_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $md2_b64url = md2_file_b64u('filename.dat'); | |
153 | #or | |
154 | $md2_b64url = md2_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::MD2->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::MD2->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::MD2::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/MD2_(cryptography)|http://en.wikipedia.org/wiki/MD2_(cryptography)> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::MD2; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( md2 md2_hex md2_b64 md2_b64u md2_file md2_file_hex md2_file_b64 md2_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub md2 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub md2_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub md2_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub md2_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub md2_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub md2_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub md2_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub md2_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::MD2 - Hash function MD2 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::MD2 qw( md2 md2_hex md2_b64 md2_b64u | |
41 | md2_file md2_file_hex md2_file_b64 md2_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $md2_raw = md2('data string'); | |
45 | $md2_hex = md2_hex('data string'); | |
46 | $md2_b64 = md2_b64('data string'); | |
47 | $md2_b64u = md2_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $md2_raw = md2_file('filename.dat'); | |
50 | $md2_hex = md2_file_hex('filename.dat'); | |
51 | $md2_b64 = md2_file_b64('filename.dat'); | |
52 | $md2_b64u = md2_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $md2_raw = md2_file(*FILEHANDLE); | |
55 | $md2_hex = md2_file_hex(*FILEHANDLE); | |
56 | $md2_b64 = md2_file_b64(*FILEHANDLE); | |
57 | $md2_b64u = md2_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::MD2; | |
61 | ||
62 | $d = Crypt::Digest::MD2->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the MD2 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::MD2 qw(md2 md2_hex md2_b64 md2_b64u | |
82 | md2_file md2_file_hex md2_file_b64 md2_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::MD2 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 md2 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a binary string. | |
93 | ||
94 | $md2_raw = md2('data string'); | |
95 | #or | |
96 | $md2_raw = md2('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 md2_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a hexadecimal string. | |
101 | ||
102 | $md2_hex = md2_hex('data string'); | |
103 | #or | |
104 | $md2_hex = md2_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 md2_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $md2_b64 = md2_b64('data string'); | |
111 | #or | |
112 | $md2_b64 = md2_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 md2_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its MD2 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $md2_b64url = md2_b64u('data string'); | |
119 | #or | |
120 | $md2_b64url = md2_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 md2_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a binary string. | |
125 | ||
126 | $md2_raw = md2_file('filename.dat'); | |
127 | #or | |
128 | $md2_raw = md2_file(*FILEHANDLE); | |
129 | ||
130 | =head2 md2_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a hexadecimal string. | |
133 | ||
134 | $md2_hex = md2_file_hex('filename.dat'); | |
135 | #or | |
136 | $md2_hex = md2_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 md2_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $md2_b64 = md2_file_b64('filename.dat'); | |
145 | #or | |
146 | $md2_b64 = md2_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 md2_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its MD2 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $md2_b64url = md2_file_b64u('filename.dat'); | |
153 | #or | |
154 | $md2_b64url = md2_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::MD2->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::MD2->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::MD2::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/MD2_(cryptography)|http://en.wikipedia.org/wiki/MD2_(cryptography)> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::MD4; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( md4 md4_hex md4_b64 md4_b64u md4_file md4_file_hex md4_file_b64 md4_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub md4 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub md4_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub md4_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub md4_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub md4_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub md4_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub md4_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub md4_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::MD4 - Hash function MD4 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::MD4 qw( md4 md4_hex md4_b64 md4_b64u | |
41 | md4_file md4_file_hex md4_file_b64 md4_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $md4_raw = md4('data string'); | |
45 | $md4_hex = md4_hex('data string'); | |
46 | $md4_b64 = md4_b64('data string'); | |
47 | $md4_b64u = md4_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $md4_raw = md4_file('filename.dat'); | |
50 | $md4_hex = md4_file_hex('filename.dat'); | |
51 | $md4_b64 = md4_file_b64('filename.dat'); | |
52 | $md4_b64u = md4_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $md4_raw = md4_file(*FILEHANDLE); | |
55 | $md4_hex = md4_file_hex(*FILEHANDLE); | |
56 | $md4_b64 = md4_file_b64(*FILEHANDLE); | |
57 | $md4_b64u = md4_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::MD4; | |
61 | ||
62 | $d = Crypt::Digest::MD4->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the MD4 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::MD4 qw(md4 md4_hex md4_b64 md4_b64u | |
82 | md4_file md4_file_hex md4_file_b64 md4_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::MD4 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 md4 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a binary string. | |
93 | ||
94 | $md4_raw = md4('data string'); | |
95 | #or | |
96 | $md4_raw = md4('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 md4_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a hexadecimal string. | |
101 | ||
102 | $md4_hex = md4_hex('data string'); | |
103 | #or | |
104 | $md4_hex = md4_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 md4_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $md4_b64 = md4_b64('data string'); | |
111 | #or | |
112 | $md4_b64 = md4_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 md4_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $md4_b64url = md4_b64u('data string'); | |
119 | #or | |
120 | $md4_b64url = md4_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 md4_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a binary string. | |
125 | ||
126 | $md4_raw = md4_file('filename.dat'); | |
127 | #or | |
128 | $md4_raw = md4_file(*FILEHANDLE); | |
129 | ||
130 | =head2 md4_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a hexadecimal string. | |
133 | ||
134 | $md4_hex = md4_file_hex('filename.dat'); | |
135 | #or | |
136 | $md4_hex = md4_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 md4_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $md4_b64 = md4_file_b64('filename.dat'); | |
145 | #or | |
146 | $md4_b64 = md4_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 md4_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $md4_b64url = md4_file_b64u('filename.dat'); | |
153 | #or | |
154 | $md4_b64url = md4_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::MD4->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::MD4->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::MD4::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/MD4|http://en.wikipedia.org/wiki/MD4> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::MD4; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( md4 md4_hex md4_b64 md4_b64u md4_file md4_file_hex md4_file_b64 md4_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub md4 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub md4_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub md4_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub md4_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub md4_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub md4_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub md4_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub md4_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::MD4 - Hash function MD4 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::MD4 qw( md4 md4_hex md4_b64 md4_b64u | |
41 | md4_file md4_file_hex md4_file_b64 md4_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $md4_raw = md4('data string'); | |
45 | $md4_hex = md4_hex('data string'); | |
46 | $md4_b64 = md4_b64('data string'); | |
47 | $md4_b64u = md4_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $md4_raw = md4_file('filename.dat'); | |
50 | $md4_hex = md4_file_hex('filename.dat'); | |
51 | $md4_b64 = md4_file_b64('filename.dat'); | |
52 | $md4_b64u = md4_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $md4_raw = md4_file(*FILEHANDLE); | |
55 | $md4_hex = md4_file_hex(*FILEHANDLE); | |
56 | $md4_b64 = md4_file_b64(*FILEHANDLE); | |
57 | $md4_b64u = md4_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::MD4; | |
61 | ||
62 | $d = Crypt::Digest::MD4->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the MD4 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::MD4 qw(md4 md4_hex md4_b64 md4_b64u | |
82 | md4_file md4_file_hex md4_file_b64 md4_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::MD4 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 md4 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a binary string. | |
93 | ||
94 | $md4_raw = md4('data string'); | |
95 | #or | |
96 | $md4_raw = md4('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 md4_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a hexadecimal string. | |
101 | ||
102 | $md4_hex = md4_hex('data string'); | |
103 | #or | |
104 | $md4_hex = md4_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 md4_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $md4_b64 = md4_b64('data string'); | |
111 | #or | |
112 | $md4_b64 = md4_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 md4_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its MD4 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $md4_b64url = md4_b64u('data string'); | |
119 | #or | |
120 | $md4_b64url = md4_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 md4_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a binary string. | |
125 | ||
126 | $md4_raw = md4_file('filename.dat'); | |
127 | #or | |
128 | $md4_raw = md4_file(*FILEHANDLE); | |
129 | ||
130 | =head2 md4_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a hexadecimal string. | |
133 | ||
134 | $md4_hex = md4_file_hex('filename.dat'); | |
135 | #or | |
136 | $md4_hex = md4_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 md4_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $md4_b64 = md4_file_b64('filename.dat'); | |
145 | #or | |
146 | $md4_b64 = md4_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 md4_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its MD4 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $md4_b64url = md4_file_b64u('filename.dat'); | |
153 | #or | |
154 | $md4_b64url = md4_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::MD4->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::MD4->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::MD4::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/MD4|http://en.wikipedia.org/wiki/MD4> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::MD5; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( md5 md5_hex md5_b64 md5_b64u md5_file md5_file_hex md5_file_b64 md5_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub md5 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub md5_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub md5_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub md5_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub md5_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub md5_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub md5_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub md5_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::MD5 - Hash function MD5 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::MD5 qw( md5 md5_hex md5_b64 md5_b64u | |
41 | md5_file md5_file_hex md5_file_b64 md5_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $md5_raw = md5('data string'); | |
45 | $md5_hex = md5_hex('data string'); | |
46 | $md5_b64 = md5_b64('data string'); | |
47 | $md5_b64u = md5_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $md5_raw = md5_file('filename.dat'); | |
50 | $md5_hex = md5_file_hex('filename.dat'); | |
51 | $md5_b64 = md5_file_b64('filename.dat'); | |
52 | $md5_b64u = md5_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $md5_raw = md5_file(*FILEHANDLE); | |
55 | $md5_hex = md5_file_hex(*FILEHANDLE); | |
56 | $md5_b64 = md5_file_b64(*FILEHANDLE); | |
57 | $md5_b64u = md5_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::MD5; | |
61 | ||
62 | $d = Crypt::Digest::MD5->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the MD5 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::MD5 qw(md5 md5_hex md5_b64 md5_b64u | |
82 | md5_file md5_file_hex md5_file_b64 md5_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::MD5 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 md5 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a binary string. | |
93 | ||
94 | $md5_raw = md5('data string'); | |
95 | #or | |
96 | $md5_raw = md5('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 md5_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a hexadecimal string. | |
101 | ||
102 | $md5_hex = md5_hex('data string'); | |
103 | #or | |
104 | $md5_hex = md5_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 md5_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $md5_b64 = md5_b64('data string'); | |
111 | #or | |
112 | $md5_b64 = md5_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 md5_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $md5_b64url = md5_b64u('data string'); | |
119 | #or | |
120 | $md5_b64url = md5_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 md5_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a binary string. | |
125 | ||
126 | $md5_raw = md5_file('filename.dat'); | |
127 | #or | |
128 | $md5_raw = md5_file(*FILEHANDLE); | |
129 | ||
130 | =head2 md5_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a hexadecimal string. | |
133 | ||
134 | $md5_hex = md5_file_hex('filename.dat'); | |
135 | #or | |
136 | $md5_hex = md5_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 md5_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $md5_b64 = md5_file_b64('filename.dat'); | |
145 | #or | |
146 | $md5_b64 = md5_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 md5_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $md5_b64url = md5_file_b64u('filename.dat'); | |
153 | #or | |
154 | $md5_b64url = md5_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::MD5->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::MD5->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::MD5::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/MD5|http://en.wikipedia.org/wiki/MD5> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::MD5; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( md5 md5_hex md5_b64 md5_b64u md5_file md5_file_hex md5_file_b64 md5_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub md5 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub md5_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub md5_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub md5_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub md5_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub md5_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub md5_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub md5_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::MD5 - Hash function MD5 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::MD5 qw( md5 md5_hex md5_b64 md5_b64u | |
41 | md5_file md5_file_hex md5_file_b64 md5_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $md5_raw = md5('data string'); | |
45 | $md5_hex = md5_hex('data string'); | |
46 | $md5_b64 = md5_b64('data string'); | |
47 | $md5_b64u = md5_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $md5_raw = md5_file('filename.dat'); | |
50 | $md5_hex = md5_file_hex('filename.dat'); | |
51 | $md5_b64 = md5_file_b64('filename.dat'); | |
52 | $md5_b64u = md5_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $md5_raw = md5_file(*FILEHANDLE); | |
55 | $md5_hex = md5_file_hex(*FILEHANDLE); | |
56 | $md5_b64 = md5_file_b64(*FILEHANDLE); | |
57 | $md5_b64u = md5_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::MD5; | |
61 | ||
62 | $d = Crypt::Digest::MD5->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the MD5 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::MD5 qw(md5 md5_hex md5_b64 md5_b64u | |
82 | md5_file md5_file_hex md5_file_b64 md5_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::MD5 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 md5 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a binary string. | |
93 | ||
94 | $md5_raw = md5('data string'); | |
95 | #or | |
96 | $md5_raw = md5('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 md5_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a hexadecimal string. | |
101 | ||
102 | $md5_hex = md5_hex('data string'); | |
103 | #or | |
104 | $md5_hex = md5_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 md5_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $md5_b64 = md5_b64('data string'); | |
111 | #or | |
112 | $md5_b64 = md5_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 md5_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its MD5 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $md5_b64url = md5_b64u('data string'); | |
119 | #or | |
120 | $md5_b64url = md5_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 md5_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a binary string. | |
125 | ||
126 | $md5_raw = md5_file('filename.dat'); | |
127 | #or | |
128 | $md5_raw = md5_file(*FILEHANDLE); | |
129 | ||
130 | =head2 md5_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a hexadecimal string. | |
133 | ||
134 | $md5_hex = md5_file_hex('filename.dat'); | |
135 | #or | |
136 | $md5_hex = md5_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 md5_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $md5_b64 = md5_file_b64('filename.dat'); | |
145 | #or | |
146 | $md5_b64 = md5_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 md5_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its MD5 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $md5_b64url = md5_file_b64u('filename.dat'); | |
153 | #or | |
154 | $md5_b64url = md5_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::MD5->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::MD5->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::MD5::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/MD5|http://en.wikipedia.org/wiki/MD5> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::RIPEMD128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd128 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd128_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd128_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd128_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd128_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd128_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd128_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd128_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD128 - Hash function RIPEMD-128 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD128 qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u | |
41 | ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd128_raw = ripemd128('data string'); | |
45 | $ripemd128_hex = ripemd128_hex('data string'); | |
46 | $ripemd128_b64 = ripemd128_b64('data string'); | |
47 | $ripemd128_b64u = ripemd128_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd128_raw = ripemd128_file('filename.dat'); | |
50 | $ripemd128_hex = ripemd128_file_hex('filename.dat'); | |
51 | $ripemd128_b64 = ripemd128_file_b64('filename.dat'); | |
52 | $ripemd128_b64u = ripemd128_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd128_raw = ripemd128_file(*FILEHANDLE); | |
55 | $ripemd128_hex = ripemd128_file_hex(*FILEHANDLE); | |
56 | $ripemd128_b64 = ripemd128_file_b64(*FILEHANDLE); | |
57 | $ripemd128_b64u = ripemd128_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD128; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD128->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD128 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD128 qw(ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u | |
82 | ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD128 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd128 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a binary string. | |
93 | ||
94 | $ripemd128_raw = ripemd128('data string'); | |
95 | #or | |
96 | $ripemd128_raw = ripemd128('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd128_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd128_hex = ripemd128_hex('data string'); | |
103 | #or | |
104 | $ripemd128_hex = ripemd128_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd128_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd128_b64 = ripemd128_b64('data string'); | |
111 | #or | |
112 | $ripemd128_b64 = ripemd128_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd128_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd128_b64url = ripemd128_b64u('data string'); | |
119 | #or | |
120 | $ripemd128_b64url = ripemd128_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd128_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a binary string. | |
125 | ||
126 | $ripemd128_raw = ripemd128_file('filename.dat'); | |
127 | #or | |
128 | $ripemd128_raw = ripemd128_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd128_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd128_hex = ripemd128_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd128_hex = ripemd128_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd128_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd128_b64 = ripemd128_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd128_b64 = ripemd128_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd128_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd128_b64url = ripemd128_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd128_b64url = ripemd128_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD128->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD128->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD128::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::RIPEMD128; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd128 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd128_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd128_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd128_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd128_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd128_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd128_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd128_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD128 - Hash function RIPEMD-128 [size: 128 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD128 qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u | |
41 | ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd128_raw = ripemd128('data string'); | |
45 | $ripemd128_hex = ripemd128_hex('data string'); | |
46 | $ripemd128_b64 = ripemd128_b64('data string'); | |
47 | $ripemd128_b64u = ripemd128_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd128_raw = ripemd128_file('filename.dat'); | |
50 | $ripemd128_hex = ripemd128_file_hex('filename.dat'); | |
51 | $ripemd128_b64 = ripemd128_file_b64('filename.dat'); | |
52 | $ripemd128_b64u = ripemd128_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd128_raw = ripemd128_file(*FILEHANDLE); | |
55 | $ripemd128_hex = ripemd128_file_hex(*FILEHANDLE); | |
56 | $ripemd128_b64 = ripemd128_file_b64(*FILEHANDLE); | |
57 | $ripemd128_b64u = ripemd128_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD128; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD128->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD128 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD128 qw(ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u | |
82 | ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD128 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd128 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a binary string. | |
93 | ||
94 | $ripemd128_raw = ripemd128('data string'); | |
95 | #or | |
96 | $ripemd128_raw = ripemd128('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd128_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd128_hex = ripemd128_hex('data string'); | |
103 | #or | |
104 | $ripemd128_hex = ripemd128_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd128_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd128_b64 = ripemd128_b64('data string'); | |
111 | #or | |
112 | $ripemd128_b64 = ripemd128_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd128_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD128 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd128_b64url = ripemd128_b64u('data string'); | |
119 | #or | |
120 | $ripemd128_b64url = ripemd128_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd128_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a binary string. | |
125 | ||
126 | $ripemd128_raw = ripemd128_file('filename.dat'); | |
127 | #or | |
128 | $ripemd128_raw = ripemd128_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd128_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd128_hex = ripemd128_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd128_hex = ripemd128_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd128_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd128_b64 = ripemd128_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd128_b64 = ripemd128_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd128_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD128 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd128_b64url = ripemd128_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd128_b64url = ripemd128_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD128->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD128->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD128::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::RIPEMD160; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd160 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd160_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd160_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd160_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd160_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd160_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd160_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd160_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD160 - Hash function RIPEMD-160 [size: 160 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD160 qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u | |
41 | ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd160_raw = ripemd160('data string'); | |
45 | $ripemd160_hex = ripemd160_hex('data string'); | |
46 | $ripemd160_b64 = ripemd160_b64('data string'); | |
47 | $ripemd160_b64u = ripemd160_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd160_raw = ripemd160_file('filename.dat'); | |
50 | $ripemd160_hex = ripemd160_file_hex('filename.dat'); | |
51 | $ripemd160_b64 = ripemd160_file_b64('filename.dat'); | |
52 | $ripemd160_b64u = ripemd160_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd160_raw = ripemd160_file(*FILEHANDLE); | |
55 | $ripemd160_hex = ripemd160_file_hex(*FILEHANDLE); | |
56 | $ripemd160_b64 = ripemd160_file_b64(*FILEHANDLE); | |
57 | $ripemd160_b64u = ripemd160_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD160; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD160->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD160 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD160 qw(ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u | |
82 | ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD160 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd160 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a binary string. | |
93 | ||
94 | $ripemd160_raw = ripemd160('data string'); | |
95 | #or | |
96 | $ripemd160_raw = ripemd160('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd160_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd160_hex = ripemd160_hex('data string'); | |
103 | #or | |
104 | $ripemd160_hex = ripemd160_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd160_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd160_b64 = ripemd160_b64('data string'); | |
111 | #or | |
112 | $ripemd160_b64 = ripemd160_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd160_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd160_b64url = ripemd160_b64u('data string'); | |
119 | #or | |
120 | $ripemd160_b64url = ripemd160_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd160_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a binary string. | |
125 | ||
126 | $ripemd160_raw = ripemd160_file('filename.dat'); | |
127 | #or | |
128 | $ripemd160_raw = ripemd160_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd160_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd160_hex = ripemd160_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd160_hex = ripemd160_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd160_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd160_b64 = ripemd160_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd160_b64 = ripemd160_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd160_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd160_b64url = ripemd160_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd160_b64url = ripemd160_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD160->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD160->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD160::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::RIPEMD160; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd160 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd160_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd160_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd160_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd160_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd160_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd160_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd160_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD160 - Hash function RIPEMD-160 [size: 160 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD160 qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u | |
41 | ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd160_raw = ripemd160('data string'); | |
45 | $ripemd160_hex = ripemd160_hex('data string'); | |
46 | $ripemd160_b64 = ripemd160_b64('data string'); | |
47 | $ripemd160_b64u = ripemd160_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd160_raw = ripemd160_file('filename.dat'); | |
50 | $ripemd160_hex = ripemd160_file_hex('filename.dat'); | |
51 | $ripemd160_b64 = ripemd160_file_b64('filename.dat'); | |
52 | $ripemd160_b64u = ripemd160_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd160_raw = ripemd160_file(*FILEHANDLE); | |
55 | $ripemd160_hex = ripemd160_file_hex(*FILEHANDLE); | |
56 | $ripemd160_b64 = ripemd160_file_b64(*FILEHANDLE); | |
57 | $ripemd160_b64u = ripemd160_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD160; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD160->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD160 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD160 qw(ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u | |
82 | ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD160 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd160 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a binary string. | |
93 | ||
94 | $ripemd160_raw = ripemd160('data string'); | |
95 | #or | |
96 | $ripemd160_raw = ripemd160('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd160_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd160_hex = ripemd160_hex('data string'); | |
103 | #or | |
104 | $ripemd160_hex = ripemd160_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd160_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd160_b64 = ripemd160_b64('data string'); | |
111 | #or | |
112 | $ripemd160_b64 = ripemd160_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd160_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd160_b64url = ripemd160_b64u('data string'); | |
119 | #or | |
120 | $ripemd160_b64url = ripemd160_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd160_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a binary string. | |
125 | ||
126 | $ripemd160_raw = ripemd160_file('filename.dat'); | |
127 | #or | |
128 | $ripemd160_raw = ripemd160_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd160_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd160_hex = ripemd160_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd160_hex = ripemd160_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd160_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd160_b64 = ripemd160_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd160_b64 = ripemd160_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd160_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD160 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd160_b64url = ripemd160_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd160_b64url = ripemd160_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD160->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD160->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD160::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::RIPEMD256; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd256 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd256_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd256_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd256_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd256_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd256_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd256_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd256_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD256 - Hash function RIPEMD-256 [size: 256 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD256 qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u | |
41 | ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd256_raw = ripemd256('data string'); | |
45 | $ripemd256_hex = ripemd256_hex('data string'); | |
46 | $ripemd256_b64 = ripemd256_b64('data string'); | |
47 | $ripemd256_b64u = ripemd256_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd256_raw = ripemd256_file('filename.dat'); | |
50 | $ripemd256_hex = ripemd256_file_hex('filename.dat'); | |
51 | $ripemd256_b64 = ripemd256_file_b64('filename.dat'); | |
52 | $ripemd256_b64u = ripemd256_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd256_raw = ripemd256_file(*FILEHANDLE); | |
55 | $ripemd256_hex = ripemd256_file_hex(*FILEHANDLE); | |
56 | $ripemd256_b64 = ripemd256_file_b64(*FILEHANDLE); | |
57 | $ripemd256_b64u = ripemd256_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD256; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD256->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD256 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD256 qw(ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u | |
82 | ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD256 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd256 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a binary string. | |
93 | ||
94 | $ripemd256_raw = ripemd256('data string'); | |
95 | #or | |
96 | $ripemd256_raw = ripemd256('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd256_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd256_hex = ripemd256_hex('data string'); | |
103 | #or | |
104 | $ripemd256_hex = ripemd256_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd256_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd256_b64 = ripemd256_b64('data string'); | |
111 | #or | |
112 | $ripemd256_b64 = ripemd256_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd256_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd256_b64url = ripemd256_b64u('data string'); | |
119 | #or | |
120 | $ripemd256_b64url = ripemd256_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd256_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a binary string. | |
125 | ||
126 | $ripemd256_raw = ripemd256_file('filename.dat'); | |
127 | #or | |
128 | $ripemd256_raw = ripemd256_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd256_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd256_hex = ripemd256_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd256_hex = ripemd256_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd256_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd256_b64 = ripemd256_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd256_b64 = ripemd256_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd256_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd256_b64url = ripemd256_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd256_b64url = ripemd256_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD256->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD256->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD256::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::RIPEMD256; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd256 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd256_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd256_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd256_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd256_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd256_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd256_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd256_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD256 - Hash function RIPEMD-256 [size: 256 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD256 qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u | |
41 | ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd256_raw = ripemd256('data string'); | |
45 | $ripemd256_hex = ripemd256_hex('data string'); | |
46 | $ripemd256_b64 = ripemd256_b64('data string'); | |
47 | $ripemd256_b64u = ripemd256_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd256_raw = ripemd256_file('filename.dat'); | |
50 | $ripemd256_hex = ripemd256_file_hex('filename.dat'); | |
51 | $ripemd256_b64 = ripemd256_file_b64('filename.dat'); | |
52 | $ripemd256_b64u = ripemd256_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd256_raw = ripemd256_file(*FILEHANDLE); | |
55 | $ripemd256_hex = ripemd256_file_hex(*FILEHANDLE); | |
56 | $ripemd256_b64 = ripemd256_file_b64(*FILEHANDLE); | |
57 | $ripemd256_b64u = ripemd256_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD256; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD256->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD256 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD256 qw(ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u | |
82 | ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD256 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd256 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a binary string. | |
93 | ||
94 | $ripemd256_raw = ripemd256('data string'); | |
95 | #or | |
96 | $ripemd256_raw = ripemd256('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd256_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd256_hex = ripemd256_hex('data string'); | |
103 | #or | |
104 | $ripemd256_hex = ripemd256_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd256_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd256_b64 = ripemd256_b64('data string'); | |
111 | #or | |
112 | $ripemd256_b64 = ripemd256_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd256_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd256_b64url = ripemd256_b64u('data string'); | |
119 | #or | |
120 | $ripemd256_b64url = ripemd256_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd256_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a binary string. | |
125 | ||
126 | $ripemd256_raw = ripemd256_file('filename.dat'); | |
127 | #or | |
128 | $ripemd256_raw = ripemd256_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd256_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd256_hex = ripemd256_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd256_hex = ripemd256_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd256_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd256_b64 = ripemd256_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd256_b64 = ripemd256_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd256_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd256_b64url = ripemd256_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd256_b64url = ripemd256_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD256->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD256->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD256::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::RIPEMD320; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd320 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd320_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd320_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd320_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd320_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd320_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd320_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd320_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD320 - Hash function RIPEMD-320 [size: 320 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD320 qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u | |
41 | ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd320_raw = ripemd320('data string'); | |
45 | $ripemd320_hex = ripemd320_hex('data string'); | |
46 | $ripemd320_b64 = ripemd320_b64('data string'); | |
47 | $ripemd320_b64u = ripemd320_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd320_raw = ripemd320_file('filename.dat'); | |
50 | $ripemd320_hex = ripemd320_file_hex('filename.dat'); | |
51 | $ripemd320_b64 = ripemd320_file_b64('filename.dat'); | |
52 | $ripemd320_b64u = ripemd320_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd320_raw = ripemd320_file(*FILEHANDLE); | |
55 | $ripemd320_hex = ripemd320_file_hex(*FILEHANDLE); | |
56 | $ripemd320_b64 = ripemd320_file_b64(*FILEHANDLE); | |
57 | $ripemd320_b64u = ripemd320_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD320; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD320->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD320 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD320 qw(ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u | |
82 | ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD320 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd320 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a binary string. | |
93 | ||
94 | $ripemd320_raw = ripemd320('data string'); | |
95 | #or | |
96 | $ripemd320_raw = ripemd320('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd320_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd320_hex = ripemd320_hex('data string'); | |
103 | #or | |
104 | $ripemd320_hex = ripemd320_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd320_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd320_b64 = ripemd320_b64('data string'); | |
111 | #or | |
112 | $ripemd320_b64 = ripemd320_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd320_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd320_b64url = ripemd320_b64u('data string'); | |
119 | #or | |
120 | $ripemd320_b64url = ripemd320_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd320_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a binary string. | |
125 | ||
126 | $ripemd320_raw = ripemd320_file('filename.dat'); | |
127 | #or | |
128 | $ripemd320_raw = ripemd320_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd320_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd320_hex = ripemd320_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd320_hex = ripemd320_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd320_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd320_b64 = ripemd320_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd320_b64 = ripemd320_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd320_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd320_b64url = ripemd320_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd320_b64url = ripemd320_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD320->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD320->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD320::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::RIPEMD320; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub ripemd320 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub ripemd320_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub ripemd320_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub ripemd320_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub ripemd320_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub ripemd320_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub ripemd320_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub ripemd320_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::RIPEMD320 - Hash function RIPEMD-320 [size: 320 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::RIPEMD320 qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u | |
41 | ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $ripemd320_raw = ripemd320('data string'); | |
45 | $ripemd320_hex = ripemd320_hex('data string'); | |
46 | $ripemd320_b64 = ripemd320_b64('data string'); | |
47 | $ripemd320_b64u = ripemd320_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $ripemd320_raw = ripemd320_file('filename.dat'); | |
50 | $ripemd320_hex = ripemd320_file_hex('filename.dat'); | |
51 | $ripemd320_b64 = ripemd320_file_b64('filename.dat'); | |
52 | $ripemd320_b64u = ripemd320_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $ripemd320_raw = ripemd320_file(*FILEHANDLE); | |
55 | $ripemd320_hex = ripemd320_file_hex(*FILEHANDLE); | |
56 | $ripemd320_b64 = ripemd320_file_b64(*FILEHANDLE); | |
57 | $ripemd320_b64u = ripemd320_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::RIPEMD320; | |
61 | ||
62 | $d = Crypt::Digest::RIPEMD320->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the RIPEMD320 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::RIPEMD320 qw(ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u | |
82 | ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::RIPEMD320 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 ripemd320 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a binary string. | |
93 | ||
94 | $ripemd320_raw = ripemd320('data string'); | |
95 | #or | |
96 | $ripemd320_raw = ripemd320('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 ripemd320_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a hexadecimal string. | |
101 | ||
102 | $ripemd320_hex = ripemd320_hex('data string'); | |
103 | #or | |
104 | $ripemd320_hex = ripemd320_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 ripemd320_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $ripemd320_b64 = ripemd320_b64('data string'); | |
111 | #or | |
112 | $ripemd320_b64 = ripemd320_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 ripemd320_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its RIPEMD320 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $ripemd320_b64url = ripemd320_b64u('data string'); | |
119 | #or | |
120 | $ripemd320_b64url = ripemd320_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 ripemd320_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a binary string. | |
125 | ||
126 | $ripemd320_raw = ripemd320_file('filename.dat'); | |
127 | #or | |
128 | $ripemd320_raw = ripemd320_file(*FILEHANDLE); | |
129 | ||
130 | =head2 ripemd320_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a hexadecimal string. | |
133 | ||
134 | $ripemd320_hex = ripemd320_file_hex('filename.dat'); | |
135 | #or | |
136 | $ripemd320_hex = ripemd320_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 ripemd320_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $ripemd320_b64 = ripemd320_file_b64('filename.dat'); | |
145 | #or | |
146 | $ripemd320_b64 = ripemd320_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 ripemd320_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its RIPEMD320 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $ripemd320_b64url = ripemd320_file_b64u('filename.dat'); | |
153 | #or | |
154 | $ripemd320_b64url = ripemd320_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::RIPEMD320->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::RIPEMD320->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::RIPEMD320::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/RIPEMD|http://en.wikipedia.org/wiki/RIPEMD> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::SHA1; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha1 sha1_hex sha1_b64 sha1_b64u sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha1 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha1_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha1_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha1_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha1_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha1_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha1_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha1_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA1 - Hash function SHA-1 [size: 160 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA1 qw( sha1 sha1_hex sha1_b64 sha1_b64u | |
41 | sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha1_raw = sha1('data string'); | |
45 | $sha1_hex = sha1_hex('data string'); | |
46 | $sha1_b64 = sha1_b64('data string'); | |
47 | $sha1_b64u = sha1_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha1_raw = sha1_file('filename.dat'); | |
50 | $sha1_hex = sha1_file_hex('filename.dat'); | |
51 | $sha1_b64 = sha1_file_b64('filename.dat'); | |
52 | $sha1_b64u = sha1_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha1_raw = sha1_file(*FILEHANDLE); | |
55 | $sha1_hex = sha1_file_hex(*FILEHANDLE); | |
56 | $sha1_b64 = sha1_file_b64(*FILEHANDLE); | |
57 | $sha1_b64u = sha1_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA1; | |
61 | ||
62 | $d = Crypt::Digest::SHA1->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA1 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA1 qw(sha1 sha1_hex sha1_b64 sha1_b64u | |
82 | sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA1 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha1 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a binary string. | |
93 | ||
94 | $sha1_raw = sha1('data string'); | |
95 | #or | |
96 | $sha1_raw = sha1('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha1_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha1_hex = sha1_hex('data string'); | |
103 | #or | |
104 | $sha1_hex = sha1_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha1_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha1_b64 = sha1_b64('data string'); | |
111 | #or | |
112 | $sha1_b64 = sha1_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha1_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha1_b64url = sha1_b64u('data string'); | |
119 | #or | |
120 | $sha1_b64url = sha1_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha1_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a binary string. | |
125 | ||
126 | $sha1_raw = sha1_file('filename.dat'); | |
127 | #or | |
128 | $sha1_raw = sha1_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha1_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha1_hex = sha1_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha1_hex = sha1_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha1_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha1_b64 = sha1_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha1_b64 = sha1_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha1_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha1_b64url = sha1_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha1_b64url = sha1_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA1->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA1->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA1::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-1|http://en.wikipedia.org/wiki/SHA-1> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::SHA1; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha1 sha1_hex sha1_b64 sha1_b64u sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha1 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha1_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha1_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha1_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha1_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha1_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha1_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha1_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA1 - Hash function SHA-1 [size: 160 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA1 qw( sha1 sha1_hex sha1_b64 sha1_b64u | |
41 | sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha1_raw = sha1('data string'); | |
45 | $sha1_hex = sha1_hex('data string'); | |
46 | $sha1_b64 = sha1_b64('data string'); | |
47 | $sha1_b64u = sha1_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha1_raw = sha1_file('filename.dat'); | |
50 | $sha1_hex = sha1_file_hex('filename.dat'); | |
51 | $sha1_b64 = sha1_file_b64('filename.dat'); | |
52 | $sha1_b64u = sha1_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha1_raw = sha1_file(*FILEHANDLE); | |
55 | $sha1_hex = sha1_file_hex(*FILEHANDLE); | |
56 | $sha1_b64 = sha1_file_b64(*FILEHANDLE); | |
57 | $sha1_b64u = sha1_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA1; | |
61 | ||
62 | $d = Crypt::Digest::SHA1->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA1 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA1 qw(sha1 sha1_hex sha1_b64 sha1_b64u | |
82 | sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA1 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha1 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a binary string. | |
93 | ||
94 | $sha1_raw = sha1('data string'); | |
95 | #or | |
96 | $sha1_raw = sha1('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha1_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha1_hex = sha1_hex('data string'); | |
103 | #or | |
104 | $sha1_hex = sha1_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha1_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha1_b64 = sha1_b64('data string'); | |
111 | #or | |
112 | $sha1_b64 = sha1_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha1_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA1 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha1_b64url = sha1_b64u('data string'); | |
119 | #or | |
120 | $sha1_b64url = sha1_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha1_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a binary string. | |
125 | ||
126 | $sha1_raw = sha1_file('filename.dat'); | |
127 | #or | |
128 | $sha1_raw = sha1_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha1_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha1_hex = sha1_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha1_hex = sha1_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha1_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha1_b64 = sha1_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha1_b64 = sha1_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha1_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA1 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha1_b64url = sha1_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha1_b64url = sha1_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA1->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA1->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA1::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-1|http://en.wikipedia.org/wiki/SHA-1> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::SHA224; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha224 sha224_hex sha224_b64 sha224_b64u sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha224 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha224_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha224_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha224_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha224_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha224_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha224_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha224_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA224 - Hash function SHA-224 [size: 224 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA224 qw( sha224 sha224_hex sha224_b64 sha224_b64u | |
41 | sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha224_raw = sha224('data string'); | |
45 | $sha224_hex = sha224_hex('data string'); | |
46 | $sha224_b64 = sha224_b64('data string'); | |
47 | $sha224_b64u = sha224_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha224_raw = sha224_file('filename.dat'); | |
50 | $sha224_hex = sha224_file_hex('filename.dat'); | |
51 | $sha224_b64 = sha224_file_b64('filename.dat'); | |
52 | $sha224_b64u = sha224_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha224_raw = sha224_file(*FILEHANDLE); | |
55 | $sha224_hex = sha224_file_hex(*FILEHANDLE); | |
56 | $sha224_b64 = sha224_file_b64(*FILEHANDLE); | |
57 | $sha224_b64u = sha224_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA224; | |
61 | ||
62 | $d = Crypt::Digest::SHA224->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA224 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA224 qw(sha224 sha224_hex sha224_b64 sha224_b64u | |
82 | sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA224 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha224 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a binary string. | |
93 | ||
94 | $sha224_raw = sha224('data string'); | |
95 | #or | |
96 | $sha224_raw = sha224('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha224_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha224_hex = sha224_hex('data string'); | |
103 | #or | |
104 | $sha224_hex = sha224_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha224_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha224_b64 = sha224_b64('data string'); | |
111 | #or | |
112 | $sha224_b64 = sha224_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha224_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha224_b64url = sha224_b64u('data string'); | |
119 | #or | |
120 | $sha224_b64url = sha224_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha224_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a binary string. | |
125 | ||
126 | $sha224_raw = sha224_file('filename.dat'); | |
127 | #or | |
128 | $sha224_raw = sha224_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha224_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha224_hex = sha224_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha224_hex = sha224_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha224_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha224_b64 = sha224_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha224_b64 = sha224_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha224_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha224_b64url = sha224_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha224_b64url = sha224_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA224->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA224->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA224::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::SHA224; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha224 sha224_hex sha224_b64 sha224_b64u sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha224 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha224_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha224_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha224_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha224_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha224_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha224_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha224_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA224 - Hash function SHA-224 [size: 224 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA224 qw( sha224 sha224_hex sha224_b64 sha224_b64u | |
41 | sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha224_raw = sha224('data string'); | |
45 | $sha224_hex = sha224_hex('data string'); | |
46 | $sha224_b64 = sha224_b64('data string'); | |
47 | $sha224_b64u = sha224_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha224_raw = sha224_file('filename.dat'); | |
50 | $sha224_hex = sha224_file_hex('filename.dat'); | |
51 | $sha224_b64 = sha224_file_b64('filename.dat'); | |
52 | $sha224_b64u = sha224_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha224_raw = sha224_file(*FILEHANDLE); | |
55 | $sha224_hex = sha224_file_hex(*FILEHANDLE); | |
56 | $sha224_b64 = sha224_file_b64(*FILEHANDLE); | |
57 | $sha224_b64u = sha224_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA224; | |
61 | ||
62 | $d = Crypt::Digest::SHA224->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA224 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA224 qw(sha224 sha224_hex sha224_b64 sha224_b64u | |
82 | sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA224 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha224 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a binary string. | |
93 | ||
94 | $sha224_raw = sha224('data string'); | |
95 | #or | |
96 | $sha224_raw = sha224('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha224_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha224_hex = sha224_hex('data string'); | |
103 | #or | |
104 | $sha224_hex = sha224_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha224_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha224_b64 = sha224_b64('data string'); | |
111 | #or | |
112 | $sha224_b64 = sha224_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha224_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha224_b64url = sha224_b64u('data string'); | |
119 | #or | |
120 | $sha224_b64url = sha224_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha224_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a binary string. | |
125 | ||
126 | $sha224_raw = sha224_file('filename.dat'); | |
127 | #or | |
128 | $sha224_raw = sha224_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha224_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha224_hex = sha224_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha224_hex = sha224_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha224_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha224_b64 = sha224_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha224_b64 = sha224_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha224_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA224 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha224_b64url = sha224_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha224_b64url = sha224_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA224->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA224->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA224::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::SHA256; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha256 sha256_hex sha256_b64 sha256_b64u sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha256 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha256_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha256_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha256_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha256_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha256_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha256_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha256_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA256 - Hash function SHA-256 [size: 256 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA256 qw( sha256 sha256_hex sha256_b64 sha256_b64u | |
41 | sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha256_raw = sha256('data string'); | |
45 | $sha256_hex = sha256_hex('data string'); | |
46 | $sha256_b64 = sha256_b64('data string'); | |
47 | $sha256_b64u = sha256_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha256_raw = sha256_file('filename.dat'); | |
50 | $sha256_hex = sha256_file_hex('filename.dat'); | |
51 | $sha256_b64 = sha256_file_b64('filename.dat'); | |
52 | $sha256_b64u = sha256_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha256_raw = sha256_file(*FILEHANDLE); | |
55 | $sha256_hex = sha256_file_hex(*FILEHANDLE); | |
56 | $sha256_b64 = sha256_file_b64(*FILEHANDLE); | |
57 | $sha256_b64u = sha256_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA256; | |
61 | ||
62 | $d = Crypt::Digest::SHA256->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA256 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA256 qw(sha256 sha256_hex sha256_b64 sha256_b64u | |
82 | sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA256 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha256 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a binary string. | |
93 | ||
94 | $sha256_raw = sha256('data string'); | |
95 | #or | |
96 | $sha256_raw = sha256('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha256_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha256_hex = sha256_hex('data string'); | |
103 | #or | |
104 | $sha256_hex = sha256_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha256_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha256_b64 = sha256_b64('data string'); | |
111 | #or | |
112 | $sha256_b64 = sha256_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha256_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha256_b64url = sha256_b64u('data string'); | |
119 | #or | |
120 | $sha256_b64url = sha256_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha256_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a binary string. | |
125 | ||
126 | $sha256_raw = sha256_file('filename.dat'); | |
127 | #or | |
128 | $sha256_raw = sha256_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha256_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha256_hex = sha256_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha256_hex = sha256_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha256_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha256_b64 = sha256_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha256_b64 = sha256_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha256_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha256_b64url = sha256_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha256_b64url = sha256_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA256->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA256->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA256::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::SHA256; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha256 sha256_hex sha256_b64 sha256_b64u sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha256 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha256_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha256_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha256_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha256_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha256_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha256_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha256_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA256 - Hash function SHA-256 [size: 256 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA256 qw( sha256 sha256_hex sha256_b64 sha256_b64u | |
41 | sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha256_raw = sha256('data string'); | |
45 | $sha256_hex = sha256_hex('data string'); | |
46 | $sha256_b64 = sha256_b64('data string'); | |
47 | $sha256_b64u = sha256_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha256_raw = sha256_file('filename.dat'); | |
50 | $sha256_hex = sha256_file_hex('filename.dat'); | |
51 | $sha256_b64 = sha256_file_b64('filename.dat'); | |
52 | $sha256_b64u = sha256_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha256_raw = sha256_file(*FILEHANDLE); | |
55 | $sha256_hex = sha256_file_hex(*FILEHANDLE); | |
56 | $sha256_b64 = sha256_file_b64(*FILEHANDLE); | |
57 | $sha256_b64u = sha256_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA256; | |
61 | ||
62 | $d = Crypt::Digest::SHA256->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA256 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA256 qw(sha256 sha256_hex sha256_b64 sha256_b64u | |
82 | sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA256 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha256 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a binary string. | |
93 | ||
94 | $sha256_raw = sha256('data string'); | |
95 | #or | |
96 | $sha256_raw = sha256('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha256_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha256_hex = sha256_hex('data string'); | |
103 | #or | |
104 | $sha256_hex = sha256_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha256_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha256_b64 = sha256_b64('data string'); | |
111 | #or | |
112 | $sha256_b64 = sha256_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha256_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha256_b64url = sha256_b64u('data string'); | |
119 | #or | |
120 | $sha256_b64url = sha256_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha256_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a binary string. | |
125 | ||
126 | $sha256_raw = sha256_file('filename.dat'); | |
127 | #or | |
128 | $sha256_raw = sha256_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha256_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha256_hex = sha256_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha256_hex = sha256_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha256_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha256_b64 = sha256_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha256_b64 = sha256_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha256_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA256 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha256_b64url = sha256_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha256_b64url = sha256_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA256->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA256->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA256::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::SHA384; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha384 sha384_hex sha384_b64 sha384_b64u sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha384 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha384_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha384_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha384_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha384_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha384_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha384_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha384_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA384 - Hash function SHA-384 [size: 384 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA384 qw( sha384 sha384_hex sha384_b64 sha384_b64u | |
41 | sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha384_raw = sha384('data string'); | |
45 | $sha384_hex = sha384_hex('data string'); | |
46 | $sha384_b64 = sha384_b64('data string'); | |
47 | $sha384_b64u = sha384_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha384_raw = sha384_file('filename.dat'); | |
50 | $sha384_hex = sha384_file_hex('filename.dat'); | |
51 | $sha384_b64 = sha384_file_b64('filename.dat'); | |
52 | $sha384_b64u = sha384_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha384_raw = sha384_file(*FILEHANDLE); | |
55 | $sha384_hex = sha384_file_hex(*FILEHANDLE); | |
56 | $sha384_b64 = sha384_file_b64(*FILEHANDLE); | |
57 | $sha384_b64u = sha384_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA384; | |
61 | ||
62 | $d = Crypt::Digest::SHA384->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA384 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA384 qw(sha384 sha384_hex sha384_b64 sha384_b64u | |
82 | sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA384 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha384 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a binary string. | |
93 | ||
94 | $sha384_raw = sha384('data string'); | |
95 | #or | |
96 | $sha384_raw = sha384('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha384_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha384_hex = sha384_hex('data string'); | |
103 | #or | |
104 | $sha384_hex = sha384_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha384_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha384_b64 = sha384_b64('data string'); | |
111 | #or | |
112 | $sha384_b64 = sha384_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha384_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha384_b64url = sha384_b64u('data string'); | |
119 | #or | |
120 | $sha384_b64url = sha384_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha384_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a binary string. | |
125 | ||
126 | $sha384_raw = sha384_file('filename.dat'); | |
127 | #or | |
128 | $sha384_raw = sha384_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha384_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha384_hex = sha384_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha384_hex = sha384_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha384_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha384_b64 = sha384_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha384_b64 = sha384_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha384_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha384_b64url = sha384_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha384_b64url = sha384_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA384->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA384->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA384::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::SHA384; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha384 sha384_hex sha384_b64 sha384_b64u sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha384 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha384_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha384_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha384_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha384_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha384_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha384_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha384_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA384 - Hash function SHA-384 [size: 384 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA384 qw( sha384 sha384_hex sha384_b64 sha384_b64u | |
41 | sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha384_raw = sha384('data string'); | |
45 | $sha384_hex = sha384_hex('data string'); | |
46 | $sha384_b64 = sha384_b64('data string'); | |
47 | $sha384_b64u = sha384_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha384_raw = sha384_file('filename.dat'); | |
50 | $sha384_hex = sha384_file_hex('filename.dat'); | |
51 | $sha384_b64 = sha384_file_b64('filename.dat'); | |
52 | $sha384_b64u = sha384_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha384_raw = sha384_file(*FILEHANDLE); | |
55 | $sha384_hex = sha384_file_hex(*FILEHANDLE); | |
56 | $sha384_b64 = sha384_file_b64(*FILEHANDLE); | |
57 | $sha384_b64u = sha384_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA384; | |
61 | ||
62 | $d = Crypt::Digest::SHA384->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA384 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA384 qw(sha384 sha384_hex sha384_b64 sha384_b64u | |
82 | sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA384 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha384 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a binary string. | |
93 | ||
94 | $sha384_raw = sha384('data string'); | |
95 | #or | |
96 | $sha384_raw = sha384('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha384_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha384_hex = sha384_hex('data string'); | |
103 | #or | |
104 | $sha384_hex = sha384_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha384_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha384_b64 = sha384_b64('data string'); | |
111 | #or | |
112 | $sha384_b64 = sha384_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha384_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha384_b64url = sha384_b64u('data string'); | |
119 | #or | |
120 | $sha384_b64url = sha384_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha384_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a binary string. | |
125 | ||
126 | $sha384_raw = sha384_file('filename.dat'); | |
127 | #or | |
128 | $sha384_raw = sha384_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha384_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha384_hex = sha384_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha384_hex = sha384_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha384_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha384_b64 = sha384_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha384_b64 = sha384_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha384_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA384 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha384_b64url = sha384_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha384_b64url = sha384_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA384->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA384->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA384::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::SHA512; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha512 sha512_hex sha512_b64 sha512_b64u sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha512 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha512_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha512_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha512_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha512_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha512_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha512_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha512_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA512 - Hash function SHA-512 [size: 512 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA512 qw( sha512 sha512_hex sha512_b64 sha512_b64u | |
41 | sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha512_raw = sha512('data string'); | |
45 | $sha512_hex = sha512_hex('data string'); | |
46 | $sha512_b64 = sha512_b64('data string'); | |
47 | $sha512_b64u = sha512_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha512_raw = sha512_file('filename.dat'); | |
50 | $sha512_hex = sha512_file_hex('filename.dat'); | |
51 | $sha512_b64 = sha512_file_b64('filename.dat'); | |
52 | $sha512_b64u = sha512_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha512_raw = sha512_file(*FILEHANDLE); | |
55 | $sha512_hex = sha512_file_hex(*FILEHANDLE); | |
56 | $sha512_b64 = sha512_file_b64(*FILEHANDLE); | |
57 | $sha512_b64u = sha512_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA512; | |
61 | ||
62 | $d = Crypt::Digest::SHA512->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA512 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA512 qw(sha512 sha512_hex sha512_b64 sha512_b64u | |
82 | sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA512 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha512 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a binary string. | |
93 | ||
94 | $sha512_raw = sha512('data string'); | |
95 | #or | |
96 | $sha512_raw = sha512('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha512_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha512_hex = sha512_hex('data string'); | |
103 | #or | |
104 | $sha512_hex = sha512_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha512_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha512_b64 = sha512_b64('data string'); | |
111 | #or | |
112 | $sha512_b64 = sha512_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha512_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha512_b64url = sha512_b64u('data string'); | |
119 | #or | |
120 | $sha512_b64url = sha512_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha512_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a binary string. | |
125 | ||
126 | $sha512_raw = sha512_file('filename.dat'); | |
127 | #or | |
128 | $sha512_raw = sha512_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha512_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha512_hex = sha512_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha512_hex = sha512_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha512_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha512_b64 = sha512_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha512_b64 = sha512_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha512_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha512_b64url = sha512_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha512_b64url = sha512_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA512->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA512->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA512::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::SHA512; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( sha512 sha512_hex sha512_b64 sha512_b64u sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub sha512 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub sha512_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub sha512_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub sha512_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub sha512_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub sha512_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub sha512_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub sha512_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::SHA512 - Hash function SHA-512 [size: 512 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::SHA512 qw( sha512 sha512_hex sha512_b64 sha512_b64u | |
41 | sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $sha512_raw = sha512('data string'); | |
45 | $sha512_hex = sha512_hex('data string'); | |
46 | $sha512_b64 = sha512_b64('data string'); | |
47 | $sha512_b64u = sha512_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $sha512_raw = sha512_file('filename.dat'); | |
50 | $sha512_hex = sha512_file_hex('filename.dat'); | |
51 | $sha512_b64 = sha512_file_b64('filename.dat'); | |
52 | $sha512_b64u = sha512_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $sha512_raw = sha512_file(*FILEHANDLE); | |
55 | $sha512_hex = sha512_file_hex(*FILEHANDLE); | |
56 | $sha512_b64 = sha512_file_b64(*FILEHANDLE); | |
57 | $sha512_b64u = sha512_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::SHA512; | |
61 | ||
62 | $d = Crypt::Digest::SHA512->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the SHA512 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::SHA512 qw(sha512 sha512_hex sha512_b64 sha512_b64u | |
82 | sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::SHA512 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 sha512 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a binary string. | |
93 | ||
94 | $sha512_raw = sha512('data string'); | |
95 | #or | |
96 | $sha512_raw = sha512('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 sha512_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a hexadecimal string. | |
101 | ||
102 | $sha512_hex = sha512_hex('data string'); | |
103 | #or | |
104 | $sha512_hex = sha512_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 sha512_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $sha512_b64 = sha512_b64('data string'); | |
111 | #or | |
112 | $sha512_b64 = sha512_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 sha512_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its SHA512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $sha512_b64url = sha512_b64u('data string'); | |
119 | #or | |
120 | $sha512_b64url = sha512_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 sha512_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a binary string. | |
125 | ||
126 | $sha512_raw = sha512_file('filename.dat'); | |
127 | #or | |
128 | $sha512_raw = sha512_file(*FILEHANDLE); | |
129 | ||
130 | =head2 sha512_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a hexadecimal string. | |
133 | ||
134 | $sha512_hex = sha512_file_hex('filename.dat'); | |
135 | #or | |
136 | $sha512_hex = sha512_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 sha512_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $sha512_b64 = sha512_file_b64('filename.dat'); | |
145 | #or | |
146 | $sha512_b64 = sha512_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 sha512_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its SHA512 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $sha512_b64url = sha512_file_b64u('filename.dat'); | |
153 | #or | |
154 | $sha512_b64url = sha512_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::SHA512->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::SHA512->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::SHA512::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/SHA-2|http://en.wikipedia.org/wiki/SHA-2> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::Tiger192; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub tiger192 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub tiger192_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub tiger192_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub tiger192_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub tiger192_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub tiger192_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub tiger192_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub tiger192_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::Tiger192 - Hash function Tiger-192 [size: 192 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::Tiger192 qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u | |
41 | tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $tiger192_raw = tiger192('data string'); | |
45 | $tiger192_hex = tiger192_hex('data string'); | |
46 | $tiger192_b64 = tiger192_b64('data string'); | |
47 | $tiger192_b64u = tiger192_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $tiger192_raw = tiger192_file('filename.dat'); | |
50 | $tiger192_hex = tiger192_file_hex('filename.dat'); | |
51 | $tiger192_b64 = tiger192_file_b64('filename.dat'); | |
52 | $tiger192_b64u = tiger192_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $tiger192_raw = tiger192_file(*FILEHANDLE); | |
55 | $tiger192_hex = tiger192_file_hex(*FILEHANDLE); | |
56 | $tiger192_b64 = tiger192_file_b64(*FILEHANDLE); | |
57 | $tiger192_b64u = tiger192_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::Tiger192; | |
61 | ||
62 | $d = Crypt::Digest::Tiger192->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the Tiger192 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::Tiger192 qw(tiger192 tiger192_hex tiger192_b64 tiger192_b64u | |
82 | tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::Tiger192 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 tiger192 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a binary string. | |
93 | ||
94 | $tiger192_raw = tiger192('data string'); | |
95 | #or | |
96 | $tiger192_raw = tiger192('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 tiger192_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a hexadecimal string. | |
101 | ||
102 | $tiger192_hex = tiger192_hex('data string'); | |
103 | #or | |
104 | $tiger192_hex = tiger192_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 tiger192_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $tiger192_b64 = tiger192_b64('data string'); | |
111 | #or | |
112 | $tiger192_b64 = tiger192_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 tiger192_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $tiger192_b64url = tiger192_b64u('data string'); | |
119 | #or | |
120 | $tiger192_b64url = tiger192_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 tiger192_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a binary string. | |
125 | ||
126 | $tiger192_raw = tiger192_file('filename.dat'); | |
127 | #or | |
128 | $tiger192_raw = tiger192_file(*FILEHANDLE); | |
129 | ||
130 | =head2 tiger192_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a hexadecimal string. | |
133 | ||
134 | $tiger192_hex = tiger192_file_hex('filename.dat'); | |
135 | #or | |
136 | $tiger192_hex = tiger192_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 tiger192_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $tiger192_b64 = tiger192_file_b64('filename.dat'); | |
145 | #or | |
146 | $tiger192_b64 = tiger192_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 tiger192_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $tiger192_b64url = tiger192_file_b64u('filename.dat'); | |
153 | #or | |
154 | $tiger192_b64url = tiger192_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::Tiger192->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::Tiger192->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::Tiger192::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/Tiger_(cryptography)|http://en.wikipedia.org/wiki/Tiger_(cryptography)> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::Tiger192; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub tiger192 { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub tiger192_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub tiger192_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub tiger192_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub tiger192_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub tiger192_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub tiger192_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub tiger192_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::Tiger192 - Hash function Tiger-192 [size: 192 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::Tiger192 qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u | |
41 | tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $tiger192_raw = tiger192('data string'); | |
45 | $tiger192_hex = tiger192_hex('data string'); | |
46 | $tiger192_b64 = tiger192_b64('data string'); | |
47 | $tiger192_b64u = tiger192_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $tiger192_raw = tiger192_file('filename.dat'); | |
50 | $tiger192_hex = tiger192_file_hex('filename.dat'); | |
51 | $tiger192_b64 = tiger192_file_b64('filename.dat'); | |
52 | $tiger192_b64u = tiger192_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $tiger192_raw = tiger192_file(*FILEHANDLE); | |
55 | $tiger192_hex = tiger192_file_hex(*FILEHANDLE); | |
56 | $tiger192_b64 = tiger192_file_b64(*FILEHANDLE); | |
57 | $tiger192_b64u = tiger192_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::Tiger192; | |
61 | ||
62 | $d = Crypt::Digest::Tiger192->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the Tiger192 digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::Tiger192 qw(tiger192 tiger192_hex tiger192_b64 tiger192_b64u | |
82 | tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::Tiger192 ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 tiger192 | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a binary string. | |
93 | ||
94 | $tiger192_raw = tiger192('data string'); | |
95 | #or | |
96 | $tiger192_raw = tiger192('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 tiger192_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a hexadecimal string. | |
101 | ||
102 | $tiger192_hex = tiger192_hex('data string'); | |
103 | #or | |
104 | $tiger192_hex = tiger192_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 tiger192_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $tiger192_b64 = tiger192_b64('data string'); | |
111 | #or | |
112 | $tiger192_b64 = tiger192_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 tiger192_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its Tiger192 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $tiger192_b64url = tiger192_b64u('data string'); | |
119 | #or | |
120 | $tiger192_b64url = tiger192_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 tiger192_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a binary string. | |
125 | ||
126 | $tiger192_raw = tiger192_file('filename.dat'); | |
127 | #or | |
128 | $tiger192_raw = tiger192_file(*FILEHANDLE); | |
129 | ||
130 | =head2 tiger192_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a hexadecimal string. | |
133 | ||
134 | $tiger192_hex = tiger192_file_hex('filename.dat'); | |
135 | #or | |
136 | $tiger192_hex = tiger192_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 tiger192_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $tiger192_b64 = tiger192_file_b64('filename.dat'); | |
145 | #or | |
146 | $tiger192_b64 = tiger192_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 tiger192_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its Tiger192 digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $tiger192_b64url = tiger192_file_b64u('filename.dat'); | |
153 | #or | |
154 | $tiger192_b64url = tiger192_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::Tiger192->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::Tiger192->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::Tiger192::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/Tiger_(cryptography)|http://en.wikipedia.org/wiki/Tiger_(cryptography)> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Digest::Whirlpool; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub whirlpool { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub whirlpool_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub whirlpool_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub whirlpool_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub whirlpool_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub whirlpool_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub whirlpool_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub whirlpool_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::Whirlpool - Hash function Whirlpool [size: 512 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::Whirlpool qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u | |
41 | whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $whirlpool_raw = whirlpool('data string'); | |
45 | $whirlpool_hex = whirlpool_hex('data string'); | |
46 | $whirlpool_b64 = whirlpool_b64('data string'); | |
47 | $whirlpool_b64u = whirlpool_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $whirlpool_raw = whirlpool_file('filename.dat'); | |
50 | $whirlpool_hex = whirlpool_file_hex('filename.dat'); | |
51 | $whirlpool_b64 = whirlpool_file_b64('filename.dat'); | |
52 | $whirlpool_b64u = whirlpool_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $whirlpool_raw = whirlpool_file(*FILEHANDLE); | |
55 | $whirlpool_hex = whirlpool_file_hex(*FILEHANDLE); | |
56 | $whirlpool_b64 = whirlpool_file_b64(*FILEHANDLE); | |
57 | $whirlpool_b64u = whirlpool_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::Whirlpool; | |
61 | ||
62 | $d = Crypt::Digest::Whirlpool->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the Whirlpool digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::Whirlpool qw(whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u | |
82 | whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::Whirlpool ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 whirlpool | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a binary string. | |
93 | ||
94 | $whirlpool_raw = whirlpool('data string'); | |
95 | #or | |
96 | $whirlpool_raw = whirlpool('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 whirlpool_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a hexadecimal string. | |
101 | ||
102 | $whirlpool_hex = whirlpool_hex('data string'); | |
103 | #or | |
104 | $whirlpool_hex = whirlpool_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 whirlpool_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $whirlpool_b64 = whirlpool_b64('data string'); | |
111 | #or | |
112 | $whirlpool_b64 = whirlpool_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 whirlpool_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $whirlpool_b64url = whirlpool_b64u('data string'); | |
119 | #or | |
120 | $whirlpool_b64url = whirlpool_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 whirlpool_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a binary string. | |
125 | ||
126 | $whirlpool_raw = whirlpool_file('filename.dat'); | |
127 | #or | |
128 | $whirlpool_raw = whirlpool_file(*FILEHANDLE); | |
129 | ||
130 | =head2 whirlpool_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a hexadecimal string. | |
133 | ||
134 | $whirlpool_hex = whirlpool_file_hex('filename.dat'); | |
135 | #or | |
136 | $whirlpool_hex = whirlpool_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 whirlpool_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $whirlpool_b64 = whirlpool_file_b64('filename.dat'); | |
145 | #or | |
146 | $whirlpool_b64 = whirlpool_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 whirlpool_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $whirlpool_b64url = whirlpool_file_b64u('filename.dat'); | |
153 | #or | |
154 | $whirlpool_b64url = whirlpool_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::Whirlpool->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::Whirlpool->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::Whirlpool::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/Whirlpool_(cryptography)|http://en.wikipedia.org/wiki/Whirlpool_(cryptography)> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
0 | package Crypt::Digest::Whirlpool; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use Carp; | |
13 | $Carp::Internal{(__PACKAGE__)}++; | |
14 | use CryptX; | |
15 | use base 'Crypt::Digest'; | |
16 | ||
17 | sub hashsize { Crypt::Digest::hashsize(__PACKAGE__) } | |
18 | ||
19 | sub whirlpool { Crypt::Digest::digest_data(__PACKAGE__, @_) } | |
20 | sub whirlpool_hex { Crypt::Digest::digest_data_hex(__PACKAGE__, @_) } | |
21 | sub whirlpool_b64 { Crypt::Digest::digest_data_b64(__PACKAGE__, @_) } | |
22 | sub whirlpool_b64u { Crypt::Digest::digest_data_b64u(__PACKAGE__, @_) } | |
23 | ||
24 | sub whirlpool_file { Crypt::Digest::digest_file(__PACKAGE__, @_) } | |
25 | sub whirlpool_file_hex { Crypt::Digest::digest_file_hex(__PACKAGE__, @_) } | |
26 | sub whirlpool_file_b64 { Crypt::Digest::digest_file_b64(__PACKAGE__, @_) } | |
27 | sub whirlpool_file_b64u { Crypt::Digest::digest_file_b64u(__PACKAGE__, @_) } | |
28 | ||
29 | 1; | |
30 | ||
31 | =pod | |
32 | ||
33 | =head1 NAME | |
34 | ||
35 | Crypt::Digest::Whirlpool - Hash function Whirlpool [size: 512 bits] | |
36 | ||
37 | =head1 SYNOPSIS | |
38 | ||
39 | ### Functional interface: | |
40 | use Crypt::Digest::Whirlpool qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u | |
41 | whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u ); | |
42 | ||
43 | # calculate digest from string/buffer | |
44 | $whirlpool_raw = whirlpool('data string'); | |
45 | $whirlpool_hex = whirlpool_hex('data string'); | |
46 | $whirlpool_b64 = whirlpool_b64('data string'); | |
47 | $whirlpool_b64u = whirlpool_b64u('data string'); | |
48 | # calculate digest from file | |
49 | $whirlpool_raw = whirlpool_file('filename.dat'); | |
50 | $whirlpool_hex = whirlpool_file_hex('filename.dat'); | |
51 | $whirlpool_b64 = whirlpool_file_b64('filename.dat'); | |
52 | $whirlpool_b64u = whirlpool_file_b64u('filename.dat'); | |
53 | # calculate digest from filehandle | |
54 | $whirlpool_raw = whirlpool_file(*FILEHANDLE); | |
55 | $whirlpool_hex = whirlpool_file_hex(*FILEHANDLE); | |
56 | $whirlpool_b64 = whirlpool_file_b64(*FILEHANDLE); | |
57 | $whirlpool_b64u = whirlpool_file_b64u(*FILEHANDLE); | |
58 | ||
59 | ### OO interface: | |
60 | use Crypt::Digest::Whirlpool; | |
61 | ||
62 | $d = Crypt::Digest::Whirlpool->new; | |
63 | $d->add('any data'); | |
64 | $d->addfile('filename.dat'); | |
65 | $d->addfile(*FILEHANDLE); | |
66 | $result_raw = $d->digest; # raw bytes | |
67 | $result_hex = $d->hexdigest; # hexadecimal form | |
68 | $result_b64 = $d->b64digest; # Base64 form | |
69 | $result_b64u = $d->b64udigest; # Base64 URL Safe form | |
70 | ||
71 | =head1 DESCRIPTION | |
72 | ||
73 | Provides an interface to the Whirlpool digest algorithm. | |
74 | ||
75 | =head1 EXPORT | |
76 | ||
77 | Nothing is exported by default. | |
78 | ||
79 | You can export selected functions: | |
80 | ||
81 | use Crypt::Digest::Whirlpool qw(whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u | |
82 | whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u); | |
83 | ||
84 | Or all of them at once: | |
85 | ||
86 | use Crypt::Digest::Whirlpool ':all'; | |
87 | ||
88 | =head1 FUNCTIONS | |
89 | ||
90 | =head2 whirlpool | |
91 | ||
92 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a binary string. | |
93 | ||
94 | $whirlpool_raw = whirlpool('data string'); | |
95 | #or | |
96 | $whirlpool_raw = whirlpool('any data', 'more data', 'even more data'); | |
97 | ||
98 | =head2 whirlpool_hex | |
99 | ||
100 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a hexadecimal string. | |
101 | ||
102 | $whirlpool_hex = whirlpool_hex('data string'); | |
103 | #or | |
104 | $whirlpool_hex = whirlpool_hex('any data', 'more data', 'even more data'); | |
105 | ||
106 | =head2 whirlpool_b64 | |
107 | ||
108 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a Base64 string, B<with> trailing '=' padding. | |
109 | ||
110 | $whirlpool_b64 = whirlpool_b64('data string'); | |
111 | #or | |
112 | $whirlpool_b64 = whirlpool_b64('any data', 'more data', 'even more data'); | |
113 | ||
114 | =head2 whirlpool_b64u | |
115 | ||
116 | Logically joins all arguments into a single string, and returns its Whirlpool digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
117 | ||
118 | $whirlpool_b64url = whirlpool_b64u('data string'); | |
119 | #or | |
120 | $whirlpool_b64url = whirlpool_b64u('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 whirlpool_file | |
123 | ||
124 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a binary string. | |
125 | ||
126 | $whirlpool_raw = whirlpool_file('filename.dat'); | |
127 | #or | |
128 | $whirlpool_raw = whirlpool_file(*FILEHANDLE); | |
129 | ||
130 | =head2 whirlpool_file_hex | |
131 | ||
132 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a hexadecimal string. | |
133 | ||
134 | $whirlpool_hex = whirlpool_file_hex('filename.dat'); | |
135 | #or | |
136 | $whirlpool_hex = whirlpool_file_hex(*FILEHANDLE); | |
137 | ||
138 | B<BEWARE:> You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. | |
139 | ||
140 | =head2 whirlpool_file_b64 | |
141 | ||
142 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a Base64 string, B<with> trailing '=' padding. | |
143 | ||
144 | $whirlpool_b64 = whirlpool_file_b64('filename.dat'); | |
145 | #or | |
146 | $whirlpool_b64 = whirlpool_file_b64(*FILEHANDLE); | |
147 | ||
148 | =head2 whirlpool_file_b64u | |
149 | ||
150 | Reads file (defined by filename or filehandle) content, and returns its Whirlpool digest encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
151 | ||
152 | $whirlpool_b64url = whirlpool_file_b64u('filename.dat'); | |
153 | #or | |
154 | $whirlpool_b64url = whirlpool_file_b64u(*FILEHANDLE); | |
155 | ||
156 | =head1 METHODS | |
157 | ||
158 | The OO interface provides the same set of functions as L<Crypt::Digest>. | |
159 | ||
160 | =head2 new | |
161 | ||
162 | $d = Crypt::Digest::Whirlpool->new(); | |
163 | ||
164 | =head2 clone | |
165 | ||
166 | $d->clone(); | |
167 | ||
168 | =head2 reset | |
169 | ||
170 | $d->reset(); | |
171 | ||
172 | =head2 add | |
173 | ||
174 | $d->add('any data'); | |
175 | #or | |
176 | $d->add('any data', 'more data', 'even more data'); | |
177 | ||
178 | =head2 addfile | |
179 | ||
180 | $d->addfile('filename.dat'); | |
181 | #or | |
182 | $d->addfile(*FILEHANDLE); | |
183 | ||
184 | =head2 add_bits | |
185 | ||
186 | $d->addfile('filename.dat'); | |
187 | #or | |
188 | $d->addfile(*FILEHANDLE); | |
189 | ||
190 | =head2 hashsize | |
191 | ||
192 | $d->hashsize; | |
193 | #or | |
194 | Crypt::Digest::Whirlpool->hashsize(); | |
195 | #or | |
196 | Crypt::Digest::Whirlpool::hashsize(); | |
197 | ||
198 | =head2 digest | |
199 | ||
200 | $result_raw = $d->digest(); | |
201 | ||
202 | =head2 hexdigest | |
203 | ||
204 | $result_hex = $d->hexdigest(); | |
205 | ||
206 | =head2 b64digest | |
207 | ||
208 | $result_b64 = $d->b64digest(); | |
209 | ||
210 | =head2 b64udigest | |
211 | ||
212 | $result_b64url = $d->b64udigest(); | |
213 | ||
214 | =head1 SEE ALSO | |
215 | ||
216 | =over 4 | |
217 | ||
218 | =item L<CryptX|CryptX>, L<Crypt::Digest|Crypt::Digest> | |
219 | ||
220 | =item L<http://en.wikipedia.org/wiki/Whirlpool_(cryptography)|http://en.wikipedia.org/wiki/Whirlpool_(cryptography)> | |
221 | ||
222 | =back | |
223 | ||
224 | =cut | |
225 | ||
226 | 226 | __END__⏎ |
0 | package Crypt::Mac::F9; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( f9 f9_hex f9_b64 f9_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub f9 { Crypt::Mac::F9->new(shift, shift)->add(@_)->mac } | |
19 | sub f9_hex { Crypt::Mac::F9->new(shift, shift)->add(@_)->hexmac } | |
20 | sub f9_b64 { Crypt::Mac::F9->new(shift, shift)->add(@_)->b64mac } | |
21 | sub f9_b64u { Crypt::Mac::F9->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::F9 - Message authentication code F9 | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::F9 qw( f9 f9_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $f9_raw = f9($cipher_name, $key, 'data buffer'); | |
38 | $f9_hex = f9_hex($cipher_name, $key, 'data buffer'); | |
39 | $f9_b64 = f9_b64($cipher_name, $key, 'data buffer'); | |
40 | $f9_b64u = f9_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::F9; | |
44 | ||
45 | $d = Crypt::Mac::F9->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the F9 message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::F9 qw(f9 f9_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::F9 ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 f9 | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a binary string. | |
75 | ||
76 | $f9_raw = f9($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $f9_raw = f9($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 f9_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $f9_hex = f9_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $f9_hex = f9_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 f9_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 string. | |
91 | ||
92 | $f9_b64 = f9_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $f9_b64 = f9_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 f9_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $f9_b64url = f9_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $f9_b64url = f9_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::F9->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
0 | package Crypt::Mac::F9; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( f9 f9_hex f9_b64 f9_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub f9 { Crypt::Mac::F9->new(shift, shift)->add(@_)->mac } | |
19 | sub f9_hex { Crypt::Mac::F9->new(shift, shift)->add(@_)->hexmac } | |
20 | sub f9_b64 { Crypt::Mac::F9->new(shift, shift)->add(@_)->b64mac } | |
21 | sub f9_b64u { Crypt::Mac::F9->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::F9 - Message authentication code F9 | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::F9 qw( f9 f9_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $f9_raw = f9($cipher_name, $key, 'data buffer'); | |
38 | $f9_hex = f9_hex($cipher_name, $key, 'data buffer'); | |
39 | $f9_b64 = f9_b64($cipher_name, $key, 'data buffer'); | |
40 | $f9_b64u = f9_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::F9; | |
44 | ||
45 | $d = Crypt::Mac::F9->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the F9 message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::F9 qw(f9 f9_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::F9 ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 f9 | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a binary string. | |
75 | ||
76 | $f9_raw = f9($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $f9_raw = f9($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 f9_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $f9_hex = f9_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $f9_hex = f9_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 f9_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 string. | |
91 | ||
92 | $f9_b64 = f9_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $f9_b64 = f9_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 f9_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $f9_b64url = f9_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $f9_b64url = f9_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::F9->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
156 | 156 | __END__⏎ |
0 | package Crypt::Mac::HMAC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( hmac hmac_hex hmac_b64 hmac_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Digest; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Digest::_trans_digest_name(shift), @_) } | |
18 | sub hmac { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->mac } | |
19 | sub hmac_hex { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub hmac_b64 { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub hmac_b64u { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::HMAC - Message authentication code HMAC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::HMAC qw( hmac hmac_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $hmac_raw = hmac('SHA256', $key, 'data buffer'); | |
38 | $hmac_hex = hmac_hex('SHA256', $key, 'data buffer'); | |
39 | $hmac_b64 = hmac_b64('SHA256', $key, 'data buffer'); | |
40 | $hmac_b64u = hmac_b64u('SHA256', $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::HMAC; | |
44 | ||
45 | $d = Crypt::Mac::HMAC->new('SHA256', $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the HMAC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::HMAC qw(hmac hmac_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::HMAC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 hmac | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a binary string. | |
75 | ||
76 | $hmac_raw = hmac($hash_name, $key, 'data buffer'); | |
77 | #or | |
78 | $hmac_raw = hmac($hash_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 hmac_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $hmac_hex = hmac_hex($hash_name, $key, 'data buffer'); | |
85 | #or | |
86 | $hmac_hex = hmac_hex($hash_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 hmac_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $hmac_b64 = hmac_b64($hash_name, $key, 'data buffer'); | |
93 | #or | |
94 | $hmac_b64 = hmac_b64($hash_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 hmac_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $hmac_b64url = hmac_b64u($hash_name, $key, 'data buffer'); | |
101 | #or | |
102 | $hmac_b64url = hmac_b64u($hash_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::HMAC->new($hash_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
0 | package Crypt::Mac::HMAC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( hmac hmac_hex hmac_b64 hmac_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Digest; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Digest::_trans_digest_name(shift), @_) } | |
18 | sub hmac { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->mac } | |
19 | sub hmac_hex { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub hmac_b64 { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub hmac_b64u { Crypt::Mac::HMAC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::HMAC - Message authentication code HMAC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::HMAC qw( hmac hmac_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $hmac_raw = hmac('SHA256', $key, 'data buffer'); | |
38 | $hmac_hex = hmac_hex('SHA256', $key, 'data buffer'); | |
39 | $hmac_b64 = hmac_b64('SHA256', $key, 'data buffer'); | |
40 | $hmac_b64u = hmac_b64u('SHA256', $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::HMAC; | |
44 | ||
45 | $d = Crypt::Mac::HMAC->new('SHA256', $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the HMAC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::HMAC qw(hmac hmac_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::HMAC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 hmac | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a binary string. | |
75 | ||
76 | $hmac_raw = hmac($hash_name, $key, 'data buffer'); | |
77 | #or | |
78 | $hmac_raw = hmac($hash_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 hmac_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $hmac_hex = hmac_hex($hash_name, $key, 'data buffer'); | |
85 | #or | |
86 | $hmac_hex = hmac_hex($hash_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 hmac_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $hmac_b64 = hmac_b64($hash_name, $key, 'data buffer'); | |
93 | #or | |
94 | $hmac_b64 = hmac_b64($hash_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 hmac_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its HMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $hmac_b64url = hmac_b64u($hash_name, $key, 'data buffer'); | |
101 | #or | |
102 | $hmac_b64url = hmac_b64u($hash_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::HMAC->new($hash_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
156 | 156 | __END__⏎ |
0 | package Crypt::Mac::OMAC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( omac omac_hex omac_b64 omac_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub omac { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->mac } | |
19 | sub omac_hex { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub omac_b64 { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub omac_b64u { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::OMAC - Message authentication code OMAC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::OMAC qw( omac omac_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $omac_raw = omac($cipher_name, $key, 'data buffer'); | |
38 | $omac_hex = omac_hex($cipher_name, $key, 'data buffer'); | |
39 | $omac_b64 = omac_b64($cipher_name, $key, 'data buffer'); | |
40 | $omac_b64u = omac_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::OMAC; | |
44 | ||
45 | $d = Crypt::Mac::OMAC->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the OMAC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::OMAC qw(omac omac_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::OMAC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 omac | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a binary string. | |
75 | ||
76 | $omac_raw = omac($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $omac_raw = omac($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 omac_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $omac_hex = omac_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $omac_hex = omac_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 omac_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $omac_b64 = omac_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $omac_b64 = omac_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 omac_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $omac_b64url = omac_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $omac_b64url = omac_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::OMAC->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
0 | package Crypt::Mac::OMAC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( omac omac_hex omac_b64 omac_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub omac { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->mac } | |
19 | sub omac_hex { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub omac_b64 { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub omac_b64u { Crypt::Mac::OMAC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::OMAC - Message authentication code OMAC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::OMAC qw( omac omac_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $omac_raw = omac($cipher_name, $key, 'data buffer'); | |
38 | $omac_hex = omac_hex($cipher_name, $key, 'data buffer'); | |
39 | $omac_b64 = omac_b64($cipher_name, $key, 'data buffer'); | |
40 | $omac_b64u = omac_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::OMAC; | |
44 | ||
45 | $d = Crypt::Mac::OMAC->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the OMAC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::OMAC qw(omac omac_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::OMAC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 omac | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a binary string. | |
75 | ||
76 | $omac_raw = omac($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $omac_raw = omac($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 omac_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $omac_hex = omac_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $omac_hex = omac_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 omac_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $omac_b64 = omac_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $omac_b64 = omac_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 omac_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its OMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $omac_b64url = omac_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $omac_b64url = omac_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::OMAC->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
156 | 156 | __END__⏎ |
0 | package Crypt::Mac::PMAC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( pmac pmac_hex pmac_b64 pmac_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub pmac { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->mac } | |
19 | sub pmac_hex { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub pmac_b64 { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub pmac_b64u { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::PMAC - Message authentication code PMAC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::PMAC qw( pmac pmac_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $pmac_raw = pmac($cipher_name, $key, 'data buffer'); | |
38 | $pmac_hex = pmac_hex($cipher_name, $key, 'data buffer'); | |
39 | $pmac_b64 = pmac_b64($cipher_name, $key, 'data buffer'); | |
40 | $pmac_b64u = pmac_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::PMAC; | |
44 | ||
45 | $d = Crypt::Mac::PMAC->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the PMAC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::PMAC qw(pmac pmac_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::PMAC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 pmac | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a binary string. | |
75 | ||
76 | $pmac_raw = pmac($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $pmac_raw = pmac($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 pmac_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $pmac_hex = pmac_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $pmac_hex = pmac_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 pmac_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $pmac_b64 = pmac_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $pmac_b64 = pmac_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 pmac_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $pmac_b64url = pmac_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $pmac_b64url = pmac_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::PMAC->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
0 | package Crypt::Mac::PMAC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( pmac pmac_hex pmac_b64 pmac_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub pmac { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->mac } | |
19 | sub pmac_hex { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub pmac_b64 { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub pmac_b64u { Crypt::Mac::PMAC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::PMAC - Message authentication code PMAC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::PMAC qw( pmac pmac_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $pmac_raw = pmac($cipher_name, $key, 'data buffer'); | |
38 | $pmac_hex = pmac_hex($cipher_name, $key, 'data buffer'); | |
39 | $pmac_b64 = pmac_b64($cipher_name, $key, 'data buffer'); | |
40 | $pmac_b64u = pmac_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::PMAC; | |
44 | ||
45 | $d = Crypt::Mac::PMAC->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the PMAC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::PMAC qw(pmac pmac_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::PMAC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 pmac | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a binary string. | |
75 | ||
76 | $pmac_raw = pmac($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $pmac_raw = pmac($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 pmac_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $pmac_hex = pmac_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $pmac_hex = pmac_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 pmac_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $pmac_b64 = pmac_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $pmac_b64 = pmac_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 pmac_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its PMAC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $pmac_b64url = pmac_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $pmac_b64url = pmac_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::PMAC->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
156 | 156 | __END__⏎ |
0 | package Crypt::Mac::Pelican; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( pelican pelican_hex pelican_b64 pelican_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | sub new { my $class = shift; _new(@_) } | |
16 | sub pelican { Crypt::Mac::Pelican->new(shift)->add(@_)->mac } | |
17 | sub pelican_hex { Crypt::Mac::Pelican->new(shift)->add(@_)->hexmac } | |
18 | sub pelican_b64 { Crypt::Mac::Pelican->new(shift)->add(@_)->b64mac } | |
19 | sub pelican_b64u { Crypt::Mac::Pelican->new(shift)->add(@_)->b64umac } | |
20 | ||
21 | 1; | |
22 | ||
23 | =pod | |
24 | ||
25 | =head1 NAME | |
26 | ||
27 | Crypt::Mac::Pelican - Message authentication code Pelican (AES based MAC) | |
28 | ||
29 | =head1 SYNOPSIS | |
30 | ||
31 | ### Functional interface: | |
32 | use Crypt::Mac::Pelican qw( pelican pelican_hex ); | |
33 | ||
34 | # calculate MAC from string/buffer | |
35 | $pelican_raw = pelican($key, 'data buffer'); | |
36 | $pelican_hex = pelican_hex($key, 'data buffer'); | |
37 | $pelican_b64 = pelican_b64($key, 'data buffer'); | |
38 | $pelican_b64u = pelican_b64u($key, 'data buffer'); | |
39 | ||
40 | ### OO interface: | |
41 | use Crypt::Mac::Pelican; | |
42 | ||
43 | $d = Crypt::Mac::Pelican->new($key); | |
44 | $d->add('any data'); | |
45 | $d->addfile('filename.dat'); | |
46 | $d->addfile(*FILEHANDLE); | |
47 | $result_raw = $d->mac; # raw bytes | |
48 | $result_hex = $d->hexmac; # hexadecimal form | |
49 | $result_b64 = $d->b64mac; # Base64 form | |
50 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
51 | ||
52 | =head1 DESCRIPTION | |
53 | ||
54 | Provides an interface to the Pelican message authentication code (MAC) algorithm. | |
55 | ||
56 | =head1 EXPORT | |
57 | ||
58 | Nothing is exported by default. | |
59 | ||
60 | You can export selected functions: | |
61 | ||
62 | use Crypt::Mac::Pelican qw(pelican pelican_hex ); | |
63 | ||
64 | Or all of them at once: | |
65 | ||
66 | use Crypt::Mac::Pelican ':all'; | |
67 | ||
68 | =head1 FUNCTIONS | |
69 | ||
70 | =head2 pelican | |
71 | ||
72 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a binary string. | |
73 | ||
74 | $pelican_raw = pelican($key, 'data buffer'); | |
75 | #or | |
76 | $pelican_raw = pelican($key, 'any data', 'more data', 'even more data'); | |
77 | ||
78 | =head2 pelican_hex | |
79 | ||
80 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a hexadecimal string. | |
81 | ||
82 | $pelican_hex = pelican_hex($key, 'data buffer'); | |
83 | #or | |
84 | $pelican_hex = pelican_hex($key, 'any data', 'more data', 'even more data'); | |
85 | ||
86 | =head2 pelican_b64 | |
87 | ||
88 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a Base64 string. | |
89 | ||
90 | $pelican_b64 = pelican_b64($key, 'data buffer'); | |
91 | #or | |
92 | $pelican_b64 = pelican_b64($key, 'any data', 'more data', 'even more data'); | |
93 | ||
94 | =head2 pelican_b64u | |
95 | ||
96 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
97 | ||
98 | $pelican_b64url = pelican_b64u($key, 'data buffer'); | |
99 | #or | |
100 | $pelican_b64url = pelican_b64u($key, 'any data', 'more data', 'even more data'); | |
101 | ||
102 | =head1 METHODS | |
103 | ||
104 | =head2 new | |
105 | ||
106 | $d = Crypt::Mac::Pelican->new($key); | |
107 | ||
108 | =head2 clone | |
109 | ||
110 | $d->clone(); | |
111 | ||
112 | =head2 reset | |
113 | ||
114 | $d->reset(); | |
115 | ||
116 | =head2 add | |
117 | ||
118 | $d->add('any data'); | |
119 | #or | |
120 | $d->add('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 addfile | |
123 | ||
124 | $d->addfile('filename.dat'); | |
125 | #or | |
126 | $d->addfile(*FILEHANDLE); | |
127 | ||
128 | =head2 mac | |
129 | ||
130 | $result_raw = $d->mac(); | |
131 | ||
132 | =head2 hexmac | |
133 | ||
134 | $result_hex = $d->hexmac(); | |
135 | ||
136 | =head2 b64mac | |
137 | ||
138 | $result_b64 = $d->b64mac(); | |
139 | ||
140 | =head2 b64umac | |
141 | ||
142 | $result_b64url = $d->b64umac(); | |
143 | ||
144 | =head1 SEE ALSO | |
145 | ||
146 | =over 4 | |
147 | ||
148 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
149 | ||
150 | =back | |
151 | ||
152 | =cut | |
153 | ||
0 | package Crypt::Mac::Pelican; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( pelican pelican_hex pelican_b64 pelican_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | sub new { my $class = shift; _new(@_) } | |
16 | sub pelican { Crypt::Mac::Pelican->new(shift)->add(@_)->mac } | |
17 | sub pelican_hex { Crypt::Mac::Pelican->new(shift)->add(@_)->hexmac } | |
18 | sub pelican_b64 { Crypt::Mac::Pelican->new(shift)->add(@_)->b64mac } | |
19 | sub pelican_b64u { Crypt::Mac::Pelican->new(shift)->add(@_)->b64umac } | |
20 | ||
21 | 1; | |
22 | ||
23 | =pod | |
24 | ||
25 | =head1 NAME | |
26 | ||
27 | Crypt::Mac::Pelican - Message authentication code Pelican (AES based MAC) | |
28 | ||
29 | =head1 SYNOPSIS | |
30 | ||
31 | ### Functional interface: | |
32 | use Crypt::Mac::Pelican qw( pelican pelican_hex ); | |
33 | ||
34 | # calculate MAC from string/buffer | |
35 | $pelican_raw = pelican($key, 'data buffer'); | |
36 | $pelican_hex = pelican_hex($key, 'data buffer'); | |
37 | $pelican_b64 = pelican_b64($key, 'data buffer'); | |
38 | $pelican_b64u = pelican_b64u($key, 'data buffer'); | |
39 | ||
40 | ### OO interface: | |
41 | use Crypt::Mac::Pelican; | |
42 | ||
43 | $d = Crypt::Mac::Pelican->new($key); | |
44 | $d->add('any data'); | |
45 | $d->addfile('filename.dat'); | |
46 | $d->addfile(*FILEHANDLE); | |
47 | $result_raw = $d->mac; # raw bytes | |
48 | $result_hex = $d->hexmac; # hexadecimal form | |
49 | $result_b64 = $d->b64mac; # Base64 form | |
50 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
51 | ||
52 | =head1 DESCRIPTION | |
53 | ||
54 | Provides an interface to the Pelican message authentication code (MAC) algorithm. | |
55 | ||
56 | =head1 EXPORT | |
57 | ||
58 | Nothing is exported by default. | |
59 | ||
60 | You can export selected functions: | |
61 | ||
62 | use Crypt::Mac::Pelican qw(pelican pelican_hex ); | |
63 | ||
64 | Or all of them at once: | |
65 | ||
66 | use Crypt::Mac::Pelican ':all'; | |
67 | ||
68 | =head1 FUNCTIONS | |
69 | ||
70 | =head2 pelican | |
71 | ||
72 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a binary string. | |
73 | ||
74 | $pelican_raw = pelican($key, 'data buffer'); | |
75 | #or | |
76 | $pelican_raw = pelican($key, 'any data', 'more data', 'even more data'); | |
77 | ||
78 | =head2 pelican_hex | |
79 | ||
80 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a hexadecimal string. | |
81 | ||
82 | $pelican_hex = pelican_hex($key, 'data buffer'); | |
83 | #or | |
84 | $pelican_hex = pelican_hex($key, 'any data', 'more data', 'even more data'); | |
85 | ||
86 | =head2 pelican_b64 | |
87 | ||
88 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a Base64 string. | |
89 | ||
90 | $pelican_b64 = pelican_b64($key, 'data buffer'); | |
91 | #or | |
92 | $pelican_b64 = pelican_b64($key, 'any data', 'more data', 'even more data'); | |
93 | ||
94 | =head2 pelican_b64u | |
95 | ||
96 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
97 | ||
98 | $pelican_b64url = pelican_b64u($key, 'data buffer'); | |
99 | #or | |
100 | $pelican_b64url = pelican_b64u($key, 'any data', 'more data', 'even more data'); | |
101 | ||
102 | =head1 METHODS | |
103 | ||
104 | =head2 new | |
105 | ||
106 | $d = Crypt::Mac::Pelican->new($key); | |
107 | ||
108 | =head2 clone | |
109 | ||
110 | $d->clone(); | |
111 | ||
112 | =head2 reset | |
113 | ||
114 | $d->reset(); | |
115 | ||
116 | =head2 add | |
117 | ||
118 | $d->add('any data'); | |
119 | #or | |
120 | $d->add('any data', 'more data', 'even more data'); | |
121 | ||
122 | =head2 addfile | |
123 | ||
124 | $d->addfile('filename.dat'); | |
125 | #or | |
126 | $d->addfile(*FILEHANDLE); | |
127 | ||
128 | =head2 mac | |
129 | ||
130 | $result_raw = $d->mac(); | |
131 | ||
132 | =head2 hexmac | |
133 | ||
134 | $result_hex = $d->hexmac(); | |
135 | ||
136 | =head2 b64mac | |
137 | ||
138 | $result_b64 = $d->b64mac(); | |
139 | ||
140 | =head2 b64umac | |
141 | ||
142 | $result_b64url = $d->b64umac(); | |
143 | ||
144 | =head1 SEE ALSO | |
145 | ||
146 | =over 4 | |
147 | ||
148 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
149 | ||
150 | =back | |
151 | ||
152 | =cut | |
153 | ||
154 | 154 | __END__⏎ |
0 | package Crypt::Mac::XCBC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( xcbc xcbc_hex xcbc_b64 xcbc_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub xcbc { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->mac } | |
19 | sub xcbc_hex { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub xcbc_b64 { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub xcbc_b64u { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::XCBC - Message authentication code XCBC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::XCBC qw( xcbc xcbc_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $xcbc_raw = xcbc($cipher_name, $key, 'data buffer'); | |
38 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'data buffer'); | |
39 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'data buffer'); | |
40 | $xcbc_b64u = xcbc_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::XCBC; | |
44 | ||
45 | $d = Crypt::Mac::XCBC->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the XCBC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::XCBC qw(xcbc xcbc_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::XCBC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 xcbc | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a binary string. | |
75 | ||
76 | $xcbc_raw = xcbc($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $xcbc_raw = xcbc($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 xcbc_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 xcbc_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 xcbc_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $xcbc_b64url = xcbc_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $xcbc_b64url = xcbc_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::XCBC->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
0 | package Crypt::Mac::XCBC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Exporter 'import'; | |
8 | our %EXPORT_TAGS = ( all => [qw( xcbc xcbc_hex xcbc_b64 xcbc_b64u )] ); | |
9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
10 | our @EXPORT = qw(); | |
11 | ||
12 | use CryptX; | |
13 | use base 'Crypt::Mac'; | |
14 | ||
15 | use Crypt::Cipher; | |
16 | ||
17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
18 | sub xcbc { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->mac } | |
19 | sub xcbc_hex { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->hexmac } | |
20 | sub xcbc_b64 { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->b64mac } | |
21 | sub xcbc_b64u { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->b64umac } | |
22 | ||
23 | 1; | |
24 | ||
25 | =pod | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Crypt::Mac::XCBC - Message authentication code XCBC | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | ### Functional interface: | |
34 | use Crypt::Mac::XCBC qw( xcbc xcbc_hex ); | |
35 | ||
36 | # calculate MAC from string/buffer | |
37 | $xcbc_raw = xcbc($cipher_name, $key, 'data buffer'); | |
38 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'data buffer'); | |
39 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'data buffer'); | |
40 | $xcbc_b64u = xcbc_b64u($cipher_name, $key, 'data buffer'); | |
41 | ||
42 | ### OO interface: | |
43 | use Crypt::Mac::XCBC; | |
44 | ||
45 | $d = Crypt::Mac::XCBC->new($cipher_name, $key); | |
46 | $d->add('any data'); | |
47 | $d->addfile('filename.dat'); | |
48 | $d->addfile(*FILEHANDLE); | |
49 | $result_raw = $d->mac; # raw bytes | |
50 | $result_hex = $d->hexmac; # hexadecimal form | |
51 | $result_b64 = $d->b64mac; # Base64 form | |
52 | $result_b64u = $d->b64umac; # Base64 URL Safe form | |
53 | ||
54 | =head1 DESCRIPTION | |
55 | ||
56 | Provides an interface to the XCBC message authentication code (MAC) algorithm. | |
57 | ||
58 | =head1 EXPORT | |
59 | ||
60 | Nothing is exported by default. | |
61 | ||
62 | You can export selected functions: | |
63 | ||
64 | use Crypt::Mac::XCBC qw(xcbc xcbc_hex ); | |
65 | ||
66 | Or all of them at once: | |
67 | ||
68 | use Crypt::Mac::XCBC ':all'; | |
69 | ||
70 | =head1 FUNCTIONS | |
71 | ||
72 | =head2 xcbc | |
73 | ||
74 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a binary string. | |
75 | ||
76 | $xcbc_raw = xcbc($cipher_name, $key, 'data buffer'); | |
77 | #or | |
78 | $xcbc_raw = xcbc($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
79 | ||
80 | =head2 xcbc_hex | |
81 | ||
82 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a hexadecimal string. | |
83 | ||
84 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'data buffer'); | |
85 | #or | |
86 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
87 | ||
88 | =head2 xcbc_b64 | |
89 | ||
90 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a Base64 string. | |
91 | ||
92 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'data buffer'); | |
93 | #or | |
94 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
95 | ||
96 | =head2 xcbc_b64u | |
97 | ||
98 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). | |
99 | ||
100 | $xcbc_b64url = xcbc_b64u($cipher_name, $key, 'data buffer'); | |
101 | #or | |
102 | $xcbc_b64url = xcbc_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); | |
103 | ||
104 | =head1 METHODS | |
105 | ||
106 | =head2 new | |
107 | ||
108 | $d = Crypt::Mac::XCBC->new($cipher_name, $key); | |
109 | ||
110 | =head2 clone | |
111 | ||
112 | $d->clone(); | |
113 | ||
114 | =head2 reset | |
115 | ||
116 | $d->reset(); | |
117 | ||
118 | =head2 add | |
119 | ||
120 | $d->add('any data'); | |
121 | #or | |
122 | $d->add('any data', 'more data', 'even more data'); | |
123 | ||
124 | =head2 addfile | |
125 | ||
126 | $d->addfile('filename.dat'); | |
127 | #or | |
128 | $d->addfile(*FILEHANDLE); | |
129 | ||
130 | =head2 mac | |
131 | ||
132 | $result_raw = $d->mac(); | |
133 | ||
134 | =head2 hexmac | |
135 | ||
136 | $result_hex = $d->hexmac(); | |
137 | ||
138 | =head2 b64mac | |
139 | ||
140 | $result_b64 = $d->b64mac(); | |
141 | ||
142 | =head2 b64umac | |
143 | ||
144 | $result_b64url = $d->b64umac(); | |
145 | ||
146 | =head1 SEE ALSO | |
147 | ||
148 | =over 4 | |
149 | ||
150 | =item L<CryptX|CryptX>, L<Crypt::Mac|Crypt::Mac> | |
151 | ||
152 | =back | |
153 | ||
154 | =cut | |
155 | ||
156 | 156 | __END__⏎ |
0 | package Crypt::Mode::CBC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::CBC - Block cipher mode CBC [Cipher-block chaining] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::CBC; | |
23 | my $m = Crypt::Mode::CBC->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | $ciphertext .= $m->finish; | |
34 | ||
35 | #decrypt more chunks | |
36 | $m->start_decrypt($key, $iv); | |
37 | my $plaintext = $m->add($some_ciphertext); | |
38 | $plaintext .= $m->add($more_ciphertext); | |
39 | $plaintext .= $m->finish; | |
40 | ||
41 | =head1 DESCRIPTION | |
42 | ||
43 | This module implements CBC cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
44 | ||
45 | =head1 METHODS | |
46 | ||
47 | =head2 new | |
48 | ||
49 | my $m = Crypt::Mode::CBC->new('AES'); | |
50 | #or | |
51 | my $m = Crypt::Mode::CBC->new('AES', $padding); | |
52 | #or | |
53 | my $m = Crypt::Mode::CBC->new('AES', $padding, $cipher_rounds); | |
54 | ||
55 | # $padding .... 0 no padding (plaintext size has to be myltiple of block length) | |
56 | # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT | |
57 | # 2 Crypt::CBC's "oneandzeroes" | |
58 | # $cipher_rounds ... optional num of rounds for given cipher | |
59 | ||
60 | =head2 encrypt | |
61 | ||
62 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
63 | ||
64 | =head2 decrypt | |
65 | ||
66 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
67 | ||
68 | =head2 start_encrypt | |
69 | ||
70 | =head2 start_decrypt | |
71 | ||
72 | =head2 add | |
73 | ||
74 | =head2 finish | |
75 | ||
76 | #encrypt more chunks | |
77 | $m->start_encrypt($key, $iv); | |
78 | my $ciphertext = ''; | |
79 | $ciphertext .= $m->add('some data'); | |
80 | $ciphertext .= $m->add('more data'); | |
81 | $ciphertext .= $m->finish; | |
82 | ||
83 | #decrypt more chunks | |
84 | $m->start_decrypt($key, $iv); | |
85 | my $plaintext = ''; | |
86 | $plaintext .= $m->add($some_ciphertext); | |
87 | $plaintext .= $m->add($more_ciphertext); | |
88 | $plaintext .= $m->finish; | |
89 | ||
90 | =head1 SEE ALSO | |
91 | ||
92 | =over 4 | |
93 | ||
94 | =item L<CryptX|CryptX> | |
95 | ||
96 | =back | |
0 | package Crypt::Mode::CBC; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::CBC - Block cipher mode CBC [Cipher-block chaining] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::CBC; | |
23 | my $m = Crypt::Mode::CBC->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | $ciphertext .= $m->finish; | |
34 | ||
35 | #decrypt more chunks | |
36 | $m->start_decrypt($key, $iv); | |
37 | my $plaintext = $m->add($some_ciphertext); | |
38 | $plaintext .= $m->add($more_ciphertext); | |
39 | $plaintext .= $m->finish; | |
40 | ||
41 | =head1 DESCRIPTION | |
42 | ||
43 | This module implements CBC cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
44 | ||
45 | =head1 METHODS | |
46 | ||
47 | =head2 new | |
48 | ||
49 | my $m = Crypt::Mode::CBC->new('AES'); | |
50 | #or | |
51 | my $m = Crypt::Mode::CBC->new('AES', $padding); | |
52 | #or | |
53 | my $m = Crypt::Mode::CBC->new('AES', $padding, $cipher_rounds); | |
54 | ||
55 | # $padding .... 0 no padding (plaintext size has to be myltiple of block length) | |
56 | # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT | |
57 | # 2 Crypt::CBC's "oneandzeroes" | |
58 | # $cipher_rounds ... optional num of rounds for given cipher | |
59 | ||
60 | =head2 encrypt | |
61 | ||
62 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
63 | ||
64 | =head2 decrypt | |
65 | ||
66 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
67 | ||
68 | =head2 start_encrypt | |
69 | ||
70 | =head2 start_decrypt | |
71 | ||
72 | =head2 add | |
73 | ||
74 | =head2 finish | |
75 | ||
76 | #encrypt more chunks | |
77 | $m->start_encrypt($key, $iv); | |
78 | my $ciphertext = ''; | |
79 | $ciphertext .= $m->add('some data'); | |
80 | $ciphertext .= $m->add('more data'); | |
81 | $ciphertext .= $m->finish; | |
82 | ||
83 | #decrypt more chunks | |
84 | $m->start_decrypt($key, $iv); | |
85 | my $plaintext = ''; | |
86 | $plaintext .= $m->add($some_ciphertext); | |
87 | $plaintext .= $m->add($more_ciphertext); | |
88 | $plaintext .= $m->finish; | |
89 | ||
90 | =head1 SEE ALSO | |
91 | ||
92 | =over 4 | |
93 | ||
94 | =item L<CryptX|CryptX> | |
95 | ||
96 | =back |
0 | package Crypt::Mode::CFB; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::CFB - Block cipher mode CFB [Cipher feedback] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::CFB; | |
23 | my $m = Crypt::Mode::CFB->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | ||
34 | #decrypt more chunks | |
35 | $m->start_decrypt($key, $iv); | |
36 | my $plaintext = $m->add($some_ciphertext); | |
37 | $plaintext .= $m->add($more_ciphertext); | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | This module implements CFB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
42 | ||
43 | =head1 METHODS | |
44 | ||
45 | =head2 new | |
46 | ||
47 | my $m = Crypt::Mode::CFB->new('AES'); | |
48 | #or | |
49 | my $m = Crypt::Mode::CFB->new('AES', $cipher_rounds); | |
50 | ||
51 | # $cipher_rounds ... optional num of rounds for given cipher | |
52 | ||
53 | =head2 encrypt | |
54 | ||
55 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
56 | ||
57 | =head2 decrypt | |
58 | ||
59 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
60 | ||
61 | =head2 start_encrypt | |
62 | ||
63 | =head2 start_decrypt | |
64 | ||
65 | =head2 add | |
66 | ||
67 | =head2 finish | |
68 | ||
69 | #encrypt more chunks | |
70 | $m->start_encrypt($key, $iv); | |
71 | my $ciphertext = ''; | |
72 | $ciphertext .= $m->add('some data'); | |
73 | $ciphertext .= $m->add('more data'); | |
74 | ||
75 | #decrypt more chunks | |
76 | $m->start_decrypt($key, $iv); | |
77 | my $plaintext = ''; | |
78 | $plaintext .= $m->add($some_ciphertext); | |
79 | $plaintext .= $m->add($more_ciphertext); | |
80 | ||
81 | =head1 SEE ALSO | |
82 | ||
83 | =over 4 | |
84 | ||
85 | =item L<CryptX|CryptX> | |
86 | ||
87 | =back | |
0 | package Crypt::Mode::CFB; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::CFB - Block cipher mode CFB [Cipher feedback] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::CFB; | |
23 | my $m = Crypt::Mode::CFB->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | ||
34 | #decrypt more chunks | |
35 | $m->start_decrypt($key, $iv); | |
36 | my $plaintext = $m->add($some_ciphertext); | |
37 | $plaintext .= $m->add($more_ciphertext); | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | This module implements CFB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
42 | ||
43 | =head1 METHODS | |
44 | ||
45 | =head2 new | |
46 | ||
47 | my $m = Crypt::Mode::CFB->new('AES'); | |
48 | #or | |
49 | my $m = Crypt::Mode::CFB->new('AES', $cipher_rounds); | |
50 | ||
51 | # $cipher_rounds ... optional num of rounds for given cipher | |
52 | ||
53 | =head2 encrypt | |
54 | ||
55 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
56 | ||
57 | =head2 decrypt | |
58 | ||
59 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
60 | ||
61 | =head2 start_encrypt | |
62 | ||
63 | =head2 start_decrypt | |
64 | ||
65 | =head2 add | |
66 | ||
67 | =head2 finish | |
68 | ||
69 | #encrypt more chunks | |
70 | $m->start_encrypt($key, $iv); | |
71 | my $ciphertext = ''; | |
72 | $ciphertext .= $m->add('some data'); | |
73 | $ciphertext .= $m->add('more data'); | |
74 | ||
75 | #decrypt more chunks | |
76 | $m->start_decrypt($key, $iv); | |
77 | my $plaintext = ''; | |
78 | $plaintext .= $m->add($some_ciphertext); | |
79 | $plaintext .= $m->add($more_ciphertext); | |
80 | ||
81 | =head1 SEE ALSO | |
82 | ||
83 | =over 4 | |
84 | ||
85 | =item L<CryptX|CryptX> | |
86 | ||
87 | =back |
0 | package Crypt::Mode::CTR; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::CTR - Block cipher mode CTR [Counter mode] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::CTR; | |
23 | my $m = Crypt::Mode::CTR->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | ||
34 | #decrypt more chunks | |
35 | $m->start_decrypt($key, $iv); | |
36 | my $plaintext = $m->add($some_ciphertext); | |
37 | $plaintext .= $m->add($more_ciphertext); | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | This module implements CTR cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
42 | ||
43 | =head1 METHODS | |
44 | ||
45 | =head2 new | |
46 | ||
47 | my $m = Crypt::Mode::CTR->new($cipher_name); | |
48 | #or | |
49 | my $m = Crypt::Mode::CTR->new($cipher_name, $ctr_mode, $ctr_width); | |
50 | #or | |
51 | my $m = Crypt::Mode::CTR->new($cipher_name, $ctr_mode, $ctr_width, $cipher_rounds); | |
52 | ||
53 | # $ctr_mode .... 0 little-endian counter (DEFAULT) | |
54 | # 1 big-endian counter | |
55 | # 2 little-endian + RFC3686 incrementing | |
56 | # 3 big-endian + RFC3686 incrementing | |
57 | # $ctr_width ... counter width in bytes (DEFAULT = full block width) | |
58 | # $cipher_rounds ... optional num of rounds for given cipher | |
59 | ||
60 | =head2 encrypt | |
61 | ||
62 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
63 | ||
64 | =head2 decrypt | |
65 | ||
66 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
67 | ||
68 | =head2 start_encrypt | |
69 | ||
70 | =head2 start_decrypt | |
71 | ||
72 | =head2 add | |
73 | ||
74 | =head2 finish | |
75 | ||
76 | #encrypt more chunks | |
77 | $m->start_encrypt($key, $iv); | |
78 | my $ciphertext = ''; | |
79 | $ciphertext .= $m->add('some data'); | |
80 | $ciphertext .= $m->add('more data'); | |
81 | ||
82 | #decrypt more chunks | |
83 | $m->start_decrypt($key, $iv); | |
84 | my $plaintext = ''; | |
85 | $plaintext .= $m->add($some_ciphertext); | |
86 | $plaintext .= $m->add($more_ciphertext); | |
87 | ||
88 | =head1 SEE ALSO | |
89 | ||
90 | =over 4 | |
91 | ||
92 | =item L<CryptX|CryptX> | |
93 | ||
94 | =back | |
0 | package Crypt::Mode::CTR; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::CTR - Block cipher mode CTR [Counter mode] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::CTR; | |
23 | my $m = Crypt::Mode::CTR->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | ||
34 | #decrypt more chunks | |
35 | $m->start_decrypt($key, $iv); | |
36 | my $plaintext = $m->add($some_ciphertext); | |
37 | $plaintext .= $m->add($more_ciphertext); | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | This module implements CTR cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
42 | ||
43 | =head1 METHODS | |
44 | ||
45 | =head2 new | |
46 | ||
47 | my $m = Crypt::Mode::CTR->new($cipher_name); | |
48 | #or | |
49 | my $m = Crypt::Mode::CTR->new($cipher_name, $ctr_mode, $ctr_width); | |
50 | #or | |
51 | my $m = Crypt::Mode::CTR->new($cipher_name, $ctr_mode, $ctr_width, $cipher_rounds); | |
52 | ||
53 | # $ctr_mode .... 0 little-endian counter (DEFAULT) | |
54 | # 1 big-endian counter | |
55 | # 2 little-endian + RFC3686 incrementing | |
56 | # 3 big-endian + RFC3686 incrementing | |
57 | # $ctr_width ... counter width in bytes (DEFAULT = full block width) | |
58 | # $cipher_rounds ... optional num of rounds for given cipher | |
59 | ||
60 | =head2 encrypt | |
61 | ||
62 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
63 | ||
64 | =head2 decrypt | |
65 | ||
66 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
67 | ||
68 | =head2 start_encrypt | |
69 | ||
70 | =head2 start_decrypt | |
71 | ||
72 | =head2 add | |
73 | ||
74 | =head2 finish | |
75 | ||
76 | #encrypt more chunks | |
77 | $m->start_encrypt($key, $iv); | |
78 | my $ciphertext = ''; | |
79 | $ciphertext .= $m->add('some data'); | |
80 | $ciphertext .= $m->add('more data'); | |
81 | ||
82 | #decrypt more chunks | |
83 | $m->start_decrypt($key, $iv); | |
84 | my $plaintext = ''; | |
85 | $plaintext .= $m->add($some_ciphertext); | |
86 | $plaintext .= $m->add($more_ciphertext); | |
87 | ||
88 | =head1 SEE ALSO | |
89 | ||
90 | =over 4 | |
91 | ||
92 | =item L<CryptX|CryptX> | |
93 | ||
94 | =back |
0 | package Crypt::Mode::ECB; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::ECB - Block cipher mode ECB [Electronic codebook] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::ECB; | |
23 | my $m = Crypt::Mode::ECB->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | $ciphertext .= $m->finish; | |
34 | ||
35 | #decrypt more chunks | |
36 | $m->start_decrypt($key); | |
37 | my $plaintext = $m->add($some_ciphertext); | |
38 | $plaintext .= $m->add($more_ciphertext); | |
39 | $plaintext .= $m->finish; | |
40 | ||
41 | =head1 DESCRIPTION | |
42 | ||
43 | This module implements ECB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
44 | BEWARE: ECB is inherently insecure, if you are not sure go for L<Crypt::Mode::CBC>! | |
45 | ||
46 | =head1 METHODS | |
47 | ||
48 | =head2 new | |
49 | ||
50 | my $m = Crypt::Mode::ECB->new('AES'); | |
51 | #or | |
52 | my $m = Crypt::Mode::ECB->new('AES', $padding); | |
53 | #or | |
54 | my $m = Crypt::Mode::ECB->new('AES', $padding, $cipher_rounds); | |
55 | ||
56 | # $padding .... 0 no padding (plaintext size has to be myltiple of block length) | |
57 | # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT | |
58 | # 2 Crypt::CBC's "oneandzeroes" | |
59 | # $cipher_rounds ... optional num of rounds for given cipher | |
60 | ||
61 | =head2 encrypt | |
62 | ||
63 | my $ciphertext = $m->encrypt($plaintext, $key); | |
64 | ||
65 | =head2 decrypt | |
66 | ||
67 | my $plaintext = $m->decrypt($ciphertext, $key); | |
68 | ||
69 | =head2 start_encrypt | |
70 | ||
71 | =head2 start_decrypt | |
72 | ||
73 | =head2 add | |
74 | ||
75 | =head2 finish | |
76 | ||
77 | #encrypt more chunks | |
78 | $m->start_encrypt($key); | |
79 | my $ciphertext = ''; | |
80 | $ciphertext .= $m->add('some data'); | |
81 | $ciphertext .= $m->add('more data'); | |
82 | $ciphertext .= $m->finish; | |
83 | ||
84 | #decrypt more chunks | |
85 | $m->start_decrypt($key); | |
86 | my $plaintext = ''; | |
87 | $plaintext .= $m->add($some_ciphertext); | |
88 | $plaintext .= $m->add($more_ciphertext); | |
89 | $plaintext .= $m->finish; | |
90 | ||
91 | =head1 SEE ALSO | |
92 | ||
93 | =over 4 | |
94 | ||
95 | =item L<CryptX|CryptX> | |
96 | ||
97 | =back | |
0 | package Crypt::Mode::ECB; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::ECB - Block cipher mode ECB [Electronic codebook] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::ECB; | |
23 | my $m = Crypt::Mode::ECB->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | $ciphertext .= $m->finish; | |
34 | ||
35 | #decrypt more chunks | |
36 | $m->start_decrypt($key); | |
37 | my $plaintext = $m->add($some_ciphertext); | |
38 | $plaintext .= $m->add($more_ciphertext); | |
39 | $plaintext .= $m->finish; | |
40 | ||
41 | =head1 DESCRIPTION | |
42 | ||
43 | This module implements ECB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
44 | BEWARE: ECB is inherently insecure, if you are not sure go for L<Crypt::Mode::CBC>! | |
45 | ||
46 | =head1 METHODS | |
47 | ||
48 | =head2 new | |
49 | ||
50 | my $m = Crypt::Mode::ECB->new('AES'); | |
51 | #or | |
52 | my $m = Crypt::Mode::ECB->new('AES', $padding); | |
53 | #or | |
54 | my $m = Crypt::Mode::ECB->new('AES', $padding, $cipher_rounds); | |
55 | ||
56 | # $padding .... 0 no padding (plaintext size has to be myltiple of block length) | |
57 | # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT | |
58 | # 2 Crypt::CBC's "oneandzeroes" | |
59 | # $cipher_rounds ... optional num of rounds for given cipher | |
60 | ||
61 | =head2 encrypt | |
62 | ||
63 | my $ciphertext = $m->encrypt($plaintext, $key); | |
64 | ||
65 | =head2 decrypt | |
66 | ||
67 | my $plaintext = $m->decrypt($ciphertext, $key); | |
68 | ||
69 | =head2 start_encrypt | |
70 | ||
71 | =head2 start_decrypt | |
72 | ||
73 | =head2 add | |
74 | ||
75 | =head2 finish | |
76 | ||
77 | #encrypt more chunks | |
78 | $m->start_encrypt($key); | |
79 | my $ciphertext = ''; | |
80 | $ciphertext .= $m->add('some data'); | |
81 | $ciphertext .= $m->add('more data'); | |
82 | $ciphertext .= $m->finish; | |
83 | ||
84 | #decrypt more chunks | |
85 | $m->start_decrypt($key); | |
86 | my $plaintext = ''; | |
87 | $plaintext .= $m->add($some_ciphertext); | |
88 | $plaintext .= $m->add($more_ciphertext); | |
89 | $plaintext .= $m->finish; | |
90 | ||
91 | =head1 SEE ALSO | |
92 | ||
93 | =over 4 | |
94 | ||
95 | =item L<CryptX|CryptX> | |
96 | ||
97 | =back |
0 | package Crypt::Mode::OFB; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::OFB - Block cipher mode OFB [Output feedback] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::OFB; | |
23 | my $m = Crypt::Mode::OFB->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | ||
34 | #decrypt more chunks | |
35 | $m->start_decrypt($key, $iv); | |
36 | my $plaintext = $m->add($some_ciphertext); | |
37 | $plaintext .= $m->add($more_ciphertext); | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | This module implements OFB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
42 | ||
43 | =head1 METHODS | |
44 | ||
45 | =head2 new | |
46 | ||
47 | my $m = Crypt::Mode::OFB->new('AES'); | |
48 | #or | |
49 | my $m = Crypt::Mode::OFB->new('AES', $cipher_rounds); | |
50 | ||
51 | # $cipher_rounds ... optional num of rounds for given cipher | |
52 | ||
53 | =head2 encrypt | |
54 | ||
55 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
56 | ||
57 | =head2 decrypt | |
58 | ||
59 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
60 | ||
61 | =head2 start_encrypt | |
62 | ||
63 | =head2 start_decrypt | |
64 | ||
65 | =head2 add | |
66 | ||
67 | =head2 finish | |
68 | ||
69 | #encrypt more chunks | |
70 | $m->start_encrypt($key, $iv); | |
71 | my $ciphertext = ''; | |
72 | $ciphertext .= $m->add('some data'); | |
73 | $ciphertext .= $m->add('more data'); | |
74 | ||
75 | #decrypt more chunks | |
76 | $m->start_decrypt($key, $iv); | |
77 | my $plaintext = ''; | |
78 | $plaintext .= $m->add($some_ciphertext); | |
79 | $plaintext .= $m->add($more_ciphertext); | |
80 | ||
81 | =head1 SEE ALSO | |
82 | ||
83 | =over 4 | |
84 | ||
85 | =item L<CryptX|CryptX> | |
86 | ||
87 | =back | |
0 | package Crypt::Mode::OFB; | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Crypt::Cipher; | |
8 | use base 'Crypt::Mode'; | |
9 | ||
10 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } | |
11 | ||
12 | 1; | |
13 | ||
14 | =pod | |
15 | ||
16 | =head1 NAME | |
17 | ||
18 | Crypt::Mode::OFB - Block cipher mode OFB [Output feedback] | |
19 | ||
20 | =head1 SYNOPSIS | |
21 | ||
22 | Crypt::Mode::OFB; | |
23 | my $m = Crypt::Mode::OFB->new('AES'); | |
24 | ||
25 | #(en|de)crypt at once | |
26 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
27 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); | |
28 | ||
29 | #encrypt more chunks | |
30 | $m->start_encrypt($key, $iv); | |
31 | my $ciphertext = $m->add('some data'); | |
32 | $ciphertext .= $m->add('more data'); | |
33 | ||
34 | #decrypt more chunks | |
35 | $m->start_decrypt($key, $iv); | |
36 | my $plaintext = $m->add($some_ciphertext); | |
37 | $plaintext .= $m->add($more_ciphertext); | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | This module implements OFB cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN). | |
42 | ||
43 | =head1 METHODS | |
44 | ||
45 | =head2 new | |
46 | ||
47 | my $m = Crypt::Mode::OFB->new('AES'); | |
48 | #or | |
49 | my $m = Crypt::Mode::OFB->new('AES', $cipher_rounds); | |
50 | ||
51 | # $cipher_rounds ... optional num of rounds for given cipher | |
52 | ||
53 | =head2 encrypt | |
54 | ||
55 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); | |
56 | ||
57 | =head2 decrypt | |
58 | ||
59 | my $plaintext = $m->encrypt($ciphertext, $key, $iv); | |
60 | ||
61 | =head2 start_encrypt | |
62 | ||
63 | =head2 start_decrypt | |
64 | ||
65 | =head2 add | |
66 | ||
67 | =head2 finish | |
68 | ||
69 | #encrypt more chunks | |
70 | $m->start_encrypt($key, $iv); | |
71 | my $ciphertext = ''; | |
72 | $ciphertext .= $m->add('some data'); | |
73 | $ciphertext .= $m->add('more data'); | |
74 | ||
75 | #decrypt more chunks | |
76 | $m->start_decrypt($key, $iv); | |
77 | my $plaintext = ''; | |
78 | $plaintext .= $m->add($some_ciphertext); | |
79 | $plaintext .= $m->add($more_ciphertext); | |
80 | ||
81 | =head1 SEE ALSO | |
82 | ||
83 | =over 4 | |
84 | ||
85 | =item L<CryptX|CryptX> | |
86 | ||
87 | =back |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::F9 | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::F9 | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct f9_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = f9_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: f9_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::F9 self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::F9 | |
34 | clone(Crypt::Mac::F9 self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct f9_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct f9_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::F9 self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = f9_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: f9_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::F9 self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = f9_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::F9 self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = f9_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::F9 self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = f9_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::F9 self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = f9_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::F9 | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::F9 | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct f9_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = f9_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: f9_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::F9 self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::F9 | |
34 | clone(Crypt::Mac::F9 self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct f9_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct f9_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::F9 self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = f9_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: f9_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::F9 self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = f9_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::F9 self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = f9_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::F9 self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = f9_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::F9 self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = f9_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: f9_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::HMAC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::HMAC | |
5 | _new(char * hash_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_hash(hash_name); | |
14 | if(id==-1) croak("FATAL: find_hash failed for '%s'", hash_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct hmac_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = hmac_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: hmac_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::HMAC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::HMAC | |
34 | clone(Crypt::Mac::HMAC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct hmac_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct hmac_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::HMAC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = hmac_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: hmac_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::HMAC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = hmac_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::HMAC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = hmac_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::HMAC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = hmac_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::HMAC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = hmac_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::HMAC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::HMAC | |
5 | _new(char * hash_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_hash(hash_name); | |
14 | if(id==-1) croak("FATAL: find_hash failed for '%s'", hash_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct hmac_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = hmac_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: hmac_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::HMAC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::HMAC | |
34 | clone(Crypt::Mac::HMAC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct hmac_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct hmac_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::HMAC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = hmac_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: hmac_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::HMAC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = hmac_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::HMAC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = hmac_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::HMAC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = hmac_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::HMAC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = hmac_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: hmac_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::OMAC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::OMAC | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct omac_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = omac_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: omac_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::OMAC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::OMAC | |
34 | clone(Crypt::Mac::OMAC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct omac_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct omac_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::OMAC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = omac_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: omac_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::OMAC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = omac_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::OMAC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = omac_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::OMAC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = omac_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::OMAC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = omac_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::OMAC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::OMAC | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct omac_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = omac_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: omac_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::OMAC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::OMAC | |
34 | clone(Crypt::Mac::OMAC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct omac_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct omac_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::OMAC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = omac_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: omac_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::OMAC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = omac_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::OMAC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = omac_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::OMAC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = omac_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::OMAC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = omac_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: omac_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::PMAC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::PMAC | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct pmac_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = pmac_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: pmac_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::PMAC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::PMAC | |
34 | clone(Crypt::Mac::PMAC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct pmac_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct pmac_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::PMAC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = pmac_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: pmac_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::PMAC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = pmac_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::PMAC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = pmac_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::PMAC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = pmac_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::PMAC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = pmac_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::PMAC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::PMAC | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct pmac_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = pmac_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: pmac_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::PMAC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::PMAC | |
34 | clone(Crypt::Mac::PMAC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct pmac_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct pmac_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::PMAC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = pmac_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: pmac_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::PMAC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = pmac_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::PMAC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = pmac_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::PMAC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = pmac_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::PMAC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = pmac_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: pmac_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::Pelican | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::Pelican | |
5 | _new(SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | ||
12 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
13 | k = (unsigned char *) SvPVbyte(key, k_len); | |
14 | ||
15 | Newz(0, RETVAL, 1, struct pelican_struct); | |
16 | if (!RETVAL) croak("FATAL: Newz failed"); | |
17 | ||
18 | rv = pelican_init(&RETVAL->state, k, (unsigned long)k_len); | |
19 | if (rv != CRYPT_OK) croak("FATAL: pelican_init failed: %s", error_to_string(rv)); | |
20 | } | |
21 | OUTPUT: | |
22 | RETVAL | |
23 | ||
24 | void | |
25 | DESTROY(Crypt::Mac::Pelican self) | |
26 | CODE: | |
27 | Safefree(self); | |
28 | ||
29 | Crypt::Mac::Pelican | |
30 | clone(Crypt::Mac::Pelican self) | |
31 | CODE: | |
32 | Newz(0, RETVAL, 1, struct pelican_struct); | |
33 | if (!RETVAL) croak("FATAL: Newz failed"); | |
34 | Copy(&self->state, &RETVAL->state, 1, struct pelican_struct); | |
35 | OUTPUT: | |
36 | RETVAL | |
37 | ||
38 | void | |
39 | _add_single(Crypt::Mac::Pelican self, SV * data) | |
40 | CODE: | |
41 | { | |
42 | int rv; | |
43 | STRLEN in_data_len; | |
44 | unsigned char *in_data; | |
45 | ||
46 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
47 | if (in_data_len>0) { | |
48 | rv = pelican_process(&self->state, in_data, (unsigned long)in_data_len); | |
49 | if (rv != CRYPT_OK) croak("FATAL: pelican_process failed: %s", error_to_string(rv)); | |
50 | } | |
51 | } | |
52 | ||
53 | SV * | |
54 | mac(Crypt::Mac::Pelican self) | |
55 | CODE: | |
56 | { | |
57 | char mac[MAXBLOCKSIZE]; | |
58 | unsigned long mac_len; | |
59 | int rv; | |
60 | ||
61 | mac_len = 16; | |
62 | rv = pelican_done(&self->state, (unsigned char*)mac); | |
63 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
64 | RETVAL = newSVpvn(mac, mac_len); | |
65 | } | |
66 | OUTPUT: | |
67 | RETVAL | |
68 | ||
69 | SV * | |
70 | b64mac(Crypt::Mac::Pelican self) | |
71 | CODE: | |
72 | { | |
73 | unsigned char mac[MAXBLOCKSIZE]; | |
74 | unsigned long mac_len; | |
75 | int rv; | |
76 | unsigned long outlen; | |
77 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
78 | ||
79 | mac_len = 16; | |
80 | rv = pelican_done(&self->state, mac); | |
81 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
82 | outlen = sizeof(mac_base64); | |
83 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
84 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
85 | RETVAL = newSVpvn(mac_base64, outlen); | |
86 | } | |
87 | OUTPUT: | |
88 | RETVAL | |
89 | ||
90 | SV * | |
91 | b64umac(Crypt::Mac::Pelican self) | |
92 | CODE: | |
93 | { | |
94 | unsigned char mac[MAXBLOCKSIZE]; | |
95 | unsigned long mac_len; | |
96 | int rv; | |
97 | unsigned long outlen; | |
98 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
99 | ||
100 | mac_len = 16; | |
101 | rv = pelican_done(&self->state, mac); | |
102 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
103 | outlen = sizeof(mac_base64); | |
104 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
105 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
106 | RETVAL = newSVpvn(mac_base64, outlen); | |
107 | } | |
108 | OUTPUT: | |
109 | RETVAL | |
110 | ||
111 | SV * | |
112 | hexmac(Crypt::Mac::Pelican self) | |
113 | CODE: | |
114 | { | |
115 | unsigned char mac[MAXBLOCKSIZE]; | |
116 | unsigned long mac_len, i; | |
117 | int rv; | |
118 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
119 | ||
120 | mac_len = 16; | |
121 | rv = pelican_done(&self->state, mac); | |
122 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
123 | mac_hex[0] = '\0'; | |
124 | for(i=0; i<mac_len; i++) | |
125 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
126 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
127 | } | |
128 | OUTPUT: | |
129 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::Pelican | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::Pelican | |
5 | _new(SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | ||
12 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
13 | k = (unsigned char *) SvPVbyte(key, k_len); | |
14 | ||
15 | Newz(0, RETVAL, 1, struct pelican_struct); | |
16 | if (!RETVAL) croak("FATAL: Newz failed"); | |
17 | ||
18 | rv = pelican_init(&RETVAL->state, k, (unsigned long)k_len); | |
19 | if (rv != CRYPT_OK) croak("FATAL: pelican_init failed: %s", error_to_string(rv)); | |
20 | } | |
21 | OUTPUT: | |
22 | RETVAL | |
23 | ||
24 | void | |
25 | DESTROY(Crypt::Mac::Pelican self) | |
26 | CODE: | |
27 | Safefree(self); | |
28 | ||
29 | Crypt::Mac::Pelican | |
30 | clone(Crypt::Mac::Pelican self) | |
31 | CODE: | |
32 | Newz(0, RETVAL, 1, struct pelican_struct); | |
33 | if (!RETVAL) croak("FATAL: Newz failed"); | |
34 | Copy(&self->state, &RETVAL->state, 1, struct pelican_struct); | |
35 | OUTPUT: | |
36 | RETVAL | |
37 | ||
38 | void | |
39 | _add_single(Crypt::Mac::Pelican self, SV * data) | |
40 | CODE: | |
41 | { | |
42 | int rv; | |
43 | STRLEN in_data_len; | |
44 | unsigned char *in_data; | |
45 | ||
46 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
47 | if (in_data_len>0) { | |
48 | rv = pelican_process(&self->state, in_data, (unsigned long)in_data_len); | |
49 | if (rv != CRYPT_OK) croak("FATAL: pelican_process failed: %s", error_to_string(rv)); | |
50 | } | |
51 | } | |
52 | ||
53 | SV * | |
54 | mac(Crypt::Mac::Pelican self) | |
55 | CODE: | |
56 | { | |
57 | char mac[MAXBLOCKSIZE]; | |
58 | unsigned long mac_len; | |
59 | int rv; | |
60 | ||
61 | mac_len = 16; | |
62 | rv = pelican_done(&self->state, (unsigned char*)mac); | |
63 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
64 | RETVAL = newSVpvn(mac, mac_len); | |
65 | } | |
66 | OUTPUT: | |
67 | RETVAL | |
68 | ||
69 | SV * | |
70 | b64mac(Crypt::Mac::Pelican self) | |
71 | CODE: | |
72 | { | |
73 | unsigned char mac[MAXBLOCKSIZE]; | |
74 | unsigned long mac_len; | |
75 | int rv; | |
76 | unsigned long outlen; | |
77 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
78 | ||
79 | mac_len = 16; | |
80 | rv = pelican_done(&self->state, mac); | |
81 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
82 | outlen = sizeof(mac_base64); | |
83 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
84 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
85 | RETVAL = newSVpvn(mac_base64, outlen); | |
86 | } | |
87 | OUTPUT: | |
88 | RETVAL | |
89 | ||
90 | SV * | |
91 | b64umac(Crypt::Mac::Pelican self) | |
92 | CODE: | |
93 | { | |
94 | unsigned char mac[MAXBLOCKSIZE]; | |
95 | unsigned long mac_len; | |
96 | int rv; | |
97 | unsigned long outlen; | |
98 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
99 | ||
100 | mac_len = 16; | |
101 | rv = pelican_done(&self->state, mac); | |
102 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
103 | outlen = sizeof(mac_base64); | |
104 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
105 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
106 | RETVAL = newSVpvn(mac_base64, outlen); | |
107 | } | |
108 | OUTPUT: | |
109 | RETVAL | |
110 | ||
111 | SV * | |
112 | hexmac(Crypt::Mac::Pelican self) | |
113 | CODE: | |
114 | { | |
115 | unsigned char mac[MAXBLOCKSIZE]; | |
116 | unsigned long mac_len, i; | |
117 | int rv; | |
118 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
119 | ||
120 | mac_len = 16; | |
121 | rv = pelican_done(&self->state, mac); | |
122 | if (rv != CRYPT_OK) croak("FATAL: pelican_done failed: %s", error_to_string(rv)); | |
123 | mac_hex[0] = '\0'; | |
124 | for(i=0; i<mac_len; i++) | |
125 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
126 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
127 | } | |
128 | OUTPUT: | |
129 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::XCBC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::XCBC | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct xcbc_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = xcbc_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: xcbc_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::XCBC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::XCBC | |
34 | clone(Crypt::Mac::XCBC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct xcbc_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct xcbc_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::XCBC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = xcbc_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: xcbc_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::XCBC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = xcbc_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::XCBC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = xcbc_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::XCBC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = xcbc_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::XCBC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = xcbc_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mac::XCBC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mac::XCBC | |
5 | _new(char * cipher_name, SV * key) | |
6 | CODE: | |
7 | { | |
8 | STRLEN k_len=0; | |
9 | unsigned char *k=NULL; | |
10 | int rv; | |
11 | int id; | |
12 | ||
13 | id = find_cipher(cipher_name); | |
14 | if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
15 | ||
16 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
17 | k = (unsigned char *) SvPVbyte(key, k_len); | |
18 | ||
19 | Newz(0, RETVAL, 1, struct xcbc_struct); | |
20 | if (!RETVAL) croak("FATAL: Newz failed"); | |
21 | ||
22 | rv = xcbc_init(&RETVAL->state, id, k, (unsigned long)k_len); | |
23 | if (rv != CRYPT_OK) croak("FATAL: xcbc_init failed: %s", error_to_string(rv)); | |
24 | } | |
25 | OUTPUT: | |
26 | RETVAL | |
27 | ||
28 | void | |
29 | DESTROY(Crypt::Mac::XCBC self) | |
30 | CODE: | |
31 | Safefree(self); | |
32 | ||
33 | Crypt::Mac::XCBC | |
34 | clone(Crypt::Mac::XCBC self) | |
35 | CODE: | |
36 | Newz(0, RETVAL, 1, struct xcbc_struct); | |
37 | if (!RETVAL) croak("FATAL: Newz failed"); | |
38 | Copy(&self->state, &RETVAL->state, 1, struct xcbc_struct); | |
39 | OUTPUT: | |
40 | RETVAL | |
41 | ||
42 | void | |
43 | _add_single(Crypt::Mac::XCBC self, SV * data) | |
44 | CODE: | |
45 | { | |
46 | int rv; | |
47 | STRLEN in_data_len; | |
48 | unsigned char *in_data; | |
49 | ||
50 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
51 | if (in_data_len>0) { | |
52 | rv = xcbc_process(&self->state, in_data, (unsigned long)in_data_len); | |
53 | if (rv != CRYPT_OK) croak("FATAL: xcbc_process failed: %s", error_to_string(rv)); | |
54 | } | |
55 | } | |
56 | ||
57 | SV * | |
58 | mac(Crypt::Mac::XCBC self) | |
59 | CODE: | |
60 | { | |
61 | char mac[MAXBLOCKSIZE]; | |
62 | unsigned long mac_len; | |
63 | int rv; | |
64 | ||
65 | mac_len = sizeof(mac); | |
66 | rv = xcbc_done(&self->state, (unsigned char*)mac, &mac_len); | |
67 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
68 | RETVAL = newSVpvn(mac, mac_len); | |
69 | } | |
70 | OUTPUT: | |
71 | RETVAL | |
72 | ||
73 | SV * | |
74 | b64mac(Crypt::Mac::XCBC self) | |
75 | CODE: | |
76 | { | |
77 | unsigned char mac[MAXBLOCKSIZE]; | |
78 | unsigned long mac_len; | |
79 | int rv; | |
80 | unsigned long outlen; | |
81 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
82 | ||
83 | mac_len = sizeof(mac); | |
84 | rv = xcbc_done(&self->state, mac, &mac_len); | |
85 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
86 | outlen = sizeof(mac_base64); | |
87 | rv = base64_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
88 | if (rv != CRYPT_OK) croak("FATAL: base64_encode failed: %s", error_to_string(rv)); | |
89 | RETVAL = newSVpvn(mac_base64, outlen); | |
90 | } | |
91 | OUTPUT: | |
92 | RETVAL | |
93 | ||
94 | SV * | |
95 | b64umac(Crypt::Mac::XCBC self) | |
96 | CODE: | |
97 | { | |
98 | unsigned char mac[MAXBLOCKSIZE]; | |
99 | unsigned long mac_len; | |
100 | int rv; | |
101 | unsigned long outlen; | |
102 | char mac_base64[MAXBLOCKSIZE*2 + 1]; | |
103 | ||
104 | mac_len = sizeof(mac); | |
105 | rv = xcbc_done(&self->state, mac, &mac_len); | |
106 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
107 | outlen = sizeof(mac_base64); | |
108 | rv = base64url_encode(mac, mac_len, (unsigned char*)mac_base64, &outlen); | |
109 | if (rv != CRYPT_OK) croak("FATAL: base64url_encode failed: %s", error_to_string(rv)); | |
110 | RETVAL = newSVpvn(mac_base64, outlen); | |
111 | } | |
112 | OUTPUT: | |
113 | RETVAL | |
114 | ||
115 | SV * | |
116 | hexmac(Crypt::Mac::XCBC self) | |
117 | CODE: | |
118 | { | |
119 | unsigned char mac[MAXBLOCKSIZE]; | |
120 | unsigned long mac_len, i; | |
121 | int rv; | |
122 | char mac_hex[MAXBLOCKSIZE*2 + 1]; | |
123 | ||
124 | mac_len = sizeof(mac); | |
125 | rv = xcbc_done(&self->state, mac, &mac_len); | |
126 | if (rv != CRYPT_OK) croak("FATAL: xcbc_done failed: %s", error_to_string(rv)); | |
127 | mac_hex[0] = '\0'; | |
128 | for(i=0; i<mac_len; i++) | |
129 | sprintf(&mac_hex[2*i], "%02x", mac[i]); | |
130 | RETVAL = newSVpvn(mac_hex, strlen(mac_hex)); | |
131 | } | |
132 | OUTPUT: | |
133 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::CBC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::CBC | |
5 | _new(char * cipher_name, int padding=1, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct cbc_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->padding_mode = padding; | |
11 | RETVAL->padlen = 0; | |
12 | RETVAL->direction = 0; | |
13 | RETVAL->cipher_rounds = rounds; | |
14 | RETVAL->cipher_id = find_cipher(cipher_name); | |
15 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
16 | } | |
17 | OUTPUT: | |
18 | RETVAL | |
19 | ||
20 | void | |
21 | DESTROY(Crypt::Mode::CBC self) | |
22 | CODE: | |
23 | Safefree(self); | |
24 | ||
25 | int | |
26 | _get_dir(Crypt::Mode::CBC self) | |
27 | CODE: | |
28 | RETVAL = self->direction; | |
29 | OUTPUT: | |
30 | RETVAL | |
31 | ||
32 | void | |
33 | _start(Crypt::Mode::CBC self, int dir, SV * key, SV * iv) | |
34 | CODE: | |
35 | { | |
36 | int rv; | |
37 | STRLEN k_len=0; | |
38 | unsigned char *k=NULL; | |
39 | STRLEN i_len=0; | |
40 | unsigned char *i=NULL; | |
41 | ||
42 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
43 | k = (unsigned char *) SvPVbyte(key, k_len); | |
44 | ||
45 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
46 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
47 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
48 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
49 | } | |
50 | rv = cbc_start(self->cipher_id, i, k, (unsigned long)k_len, self->cipher_rounds, &self->state); | |
51 | if (rv != CRYPT_OK) { | |
52 | croak("FATAL: cbc_start failed: %s", error_to_string(rv)); | |
53 | } | |
54 | ||
55 | self->direction = dir; | |
56 | self->padlen = 0; | |
57 | } | |
58 | ||
59 | SV * | |
60 | _encrypt(Crypt::Mode::CBC self, SV * data) | |
61 | CODE: | |
62 | { | |
63 | int rv, has_tmp_block, blen; | |
64 | unsigned long i; | |
65 | ||
66 | STRLEN in_data_len, in_data_start; | |
67 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
68 | ||
69 | if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction); | |
70 | ||
71 | blen = (&self->state)->blocklen; | |
72 | in_data_start = 0; | |
73 | has_tmp_block = 0; | |
74 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
75 | if (in_data_len==0) { | |
76 | RETVAL = newSVpvn("", 0); | |
77 | } | |
78 | else { | |
79 | if(self->padlen > 0) { | |
80 | i = (blen - self->padlen); | |
81 | if (in_data_len >= i) { /* enough data to fill pad */ | |
82 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
83 | in_data_len -= i; | |
84 | in_data_start = i; | |
85 | rv = cbc_encrypt(self->pad, tmp_block, blen, &self->state); | |
86 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
87 | self->padlen = 0; | |
88 | has_tmp_block = 1; | |
89 | } | |
90 | else { /* not enough data to fill pad */ | |
91 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
92 | self->padlen += (int)in_data_len; | |
93 | in_data_len = 0; | |
94 | } | |
95 | } /* padlen > 0 */ | |
96 | ||
97 | i = (unsigned long)(in_data_len % blen); | |
98 | if (in_data_len>0 && i>0) { /* save tail of data into pad */ | |
99 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
100 | self->padlen = i; | |
101 | in_data_len -= i; | |
102 | } | |
103 | ||
104 | if (in_data_len>0) { | |
105 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
106 | RETVAL = NEWSV(0, i); | |
107 | SvPOK_only(RETVAL); | |
108 | SvCUR_set(RETVAL, i); | |
109 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
110 | ||
111 | if (has_tmp_block) { | |
112 | Copy(tmp_block, out_data, blen, unsigned char); | |
113 | out_data += blen; | |
114 | } | |
115 | rv = cbc_encrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
116 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
117 | } /* in_data_len>0 */ | |
118 | else if (has_tmp_block) { | |
119 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
120 | } | |
121 | else { | |
122 | RETVAL = newSVpvn("", 0); | |
123 | } | |
124 | } | |
125 | } | |
126 | OUTPUT: | |
127 | RETVAL | |
128 | ||
129 | SV * | |
130 | _finish_enc(Crypt::Mode::CBC self) | |
131 | CODE: | |
132 | { | |
133 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
134 | int rv, blen, i, j; | |
135 | ||
136 | blen = (&self->state)->blocklen; | |
137 | if (self->padlen<0 || self->padlen>=blen) croak("FATAL: invalid padlen"); | |
138 | ||
139 | if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
140 | i = blen - self->padlen; | |
141 | if (i == 0) i = blen; | |
142 | for(j=self->padlen; j<blen; j++) self->pad[j] = (unsigned char)i; | |
143 | rv = cbc_encrypt(self->pad, tmp_block, blen, &self->state); | |
144 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
145 | } | |
146 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
147 | self->pad[self->padlen] = 0x80; | |
148 | for(j=self->padlen+1; j<blen; j++) self->pad[j] = 0; | |
149 | rv = cbc_encrypt(self->pad, tmp_block, blen, &self->state); | |
150 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
151 | } | |
152 | else { | |
153 | if (self->padlen>0) croak("FATAL: cbc_encrypt, input data length not multiple of %d", blen); | |
154 | blen = 0; | |
155 | } | |
156 | ||
157 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
158 | } | |
159 | OUTPUT: | |
160 | RETVAL | |
161 | ||
162 | SV * | |
163 | _decrypt(Crypt::Mode::CBC self, SV * data) | |
164 | CODE: | |
165 | { | |
166 | int rv, has_tmp_block, blen; | |
167 | unsigned long i; | |
168 | STRLEN in_data_len, in_data_start; | |
169 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
170 | ||
171 | if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction); | |
172 | ||
173 | blen = (&self->state)->blocklen; | |
174 | in_data_start = 0; | |
175 | has_tmp_block = 0; | |
176 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
177 | if (in_data_len==0) { | |
178 | RETVAL = newSVpvn("", 0); | |
179 | } | |
180 | else { | |
181 | ||
182 | if(self->padlen == blen) { | |
183 | rv = cbc_decrypt(self->pad, tmp_block, blen, &self->state); | |
184 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
185 | self->padlen = 0; | |
186 | has_tmp_block = 1; | |
187 | } /* padlen == blen */ | |
188 | else if(self->padlen > 0) { | |
189 | i = (blen - self->padlen); /* remaining bytes in padding buffer */ | |
190 | if (in_data_len >= i) { /* enough data to fill pad */ | |
191 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
192 | self->padlen += i; | |
193 | in_data_len -= i; | |
194 | in_data_start = i; | |
195 | if (in_data_len>0 || self->padding_mode == 0) { | |
196 | rv = cbc_decrypt(self->pad, tmp_block, blen, &self->state); | |
197 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
198 | self->padlen = 0; | |
199 | has_tmp_block = 1; | |
200 | } | |
201 | } | |
202 | else { /* not enough data to fill pad */ | |
203 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
204 | self->padlen += (int)in_data_len; | |
205 | in_data_len = 0; | |
206 | } | |
207 | } /* padlen > 0 */ | |
208 | ||
209 | /* here: a/ padlen==1..16 && in_data_len==0; b/ padlen==0 && in_data_len>0 */ | |
210 | if (in_data_len>0) { | |
211 | i = (unsigned long)(in_data_len % blen); | |
212 | if (i>0) { /* save tail of data into pad */ | |
213 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
214 | self->padlen = i; | |
215 | in_data_len -= i; | |
216 | } | |
217 | } | |
218 | ||
219 | if (in_data_len>0) { | |
220 | if(self->padlen == 0 && self->padding_mode !=0) { | |
221 | /* in case of padding keep full pad if no more data */ | |
222 | Copy(in_data+in_data_start+in_data_len-blen, self->pad, blen, unsigned char); | |
223 | self->padlen = blen; | |
224 | in_data_len -= blen; | |
225 | } | |
226 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
227 | if (i == 0) { | |
228 | RETVAL = newSVpvn("", 0); | |
229 | } | |
230 | else { | |
231 | RETVAL = NEWSV(0, i); | |
232 | SvPOK_only(RETVAL); | |
233 | SvCUR_set(RETVAL, i); | |
234 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
235 | if (has_tmp_block) { | |
236 | Copy(tmp_block, out_data, blen, unsigned char); | |
237 | out_data += blen; | |
238 | } | |
239 | rv = cbc_decrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
240 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
241 | } | |
242 | } /* in_data_len>0 */ | |
243 | else if (has_tmp_block) { | |
244 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
245 | } | |
246 | else { | |
247 | RETVAL = newSVpvn("", 0); | |
248 | } | |
249 | } | |
250 | ||
251 | } | |
252 | OUTPUT: | |
253 | RETVAL | |
254 | ||
255 | SV * | |
256 | _finish_dec(Crypt::Mode::CBC self) | |
257 | CODE: | |
258 | { | |
259 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
260 | unsigned char i; | |
261 | int rv, rv_len, blen; | |
262 | ||
263 | rv_len = 0; | |
264 | if (self->padlen > 0) { | |
265 | blen = (&self->state)->blocklen; | |
266 | if (self->padlen != blen) croak("FATAL: cipher text length has to be multiple of %d (%d)", blen, self->padlen); | |
267 | rv = cbc_decrypt(self->pad, tmp_block, blen, &self->state); | |
268 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
269 | if(self->padding_mode == 0) { /* no padding */ | |
270 | rv_len = blen; | |
271 | } | |
272 | else if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
273 | i = tmp_block[blen-1]; | |
274 | rv_len = blen - (i>blen ? blen : i); | |
275 | } | |
276 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
277 | rv_len = blen; | |
278 | while ((unsigned char)tmp_block[rv_len-1] == 0x00) rv_len--; | |
279 | if ((unsigned char)tmp_block[rv_len-1] == 0x80) rv_len--; | |
280 | if (rv_len<0) rv_len = 0; | |
281 | } | |
282 | } | |
283 | RETVAL = newSVpvn((char*)tmp_block, rv_len); | |
284 | } | |
285 | OUTPUT: | |
286 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::CBC | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::CBC | |
5 | _new(char * cipher_name, int padding=1, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct cbc_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->padding_mode = padding; | |
11 | RETVAL->padlen = 0; | |
12 | RETVAL->direction = 0; | |
13 | RETVAL->cipher_rounds = rounds; | |
14 | RETVAL->cipher_id = find_cipher(cipher_name); | |
15 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
16 | } | |
17 | OUTPUT: | |
18 | RETVAL | |
19 | ||
20 | void | |
21 | DESTROY(Crypt::Mode::CBC self) | |
22 | CODE: | |
23 | Safefree(self); | |
24 | ||
25 | int | |
26 | _get_dir(Crypt::Mode::CBC self) | |
27 | CODE: | |
28 | RETVAL = self->direction; | |
29 | OUTPUT: | |
30 | RETVAL | |
31 | ||
32 | void | |
33 | _start(Crypt::Mode::CBC self, int dir, SV * key, SV * iv) | |
34 | CODE: | |
35 | { | |
36 | int rv; | |
37 | STRLEN k_len=0; | |
38 | unsigned char *k=NULL; | |
39 | STRLEN i_len=0; | |
40 | unsigned char *i=NULL; | |
41 | ||
42 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
43 | k = (unsigned char *) SvPVbyte(key, k_len); | |
44 | ||
45 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
46 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
47 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
48 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
49 | } | |
50 | rv = cbc_start(self->cipher_id, i, k, (unsigned long)k_len, self->cipher_rounds, &self->state); | |
51 | if (rv != CRYPT_OK) { | |
52 | croak("FATAL: cbc_start failed: %s", error_to_string(rv)); | |
53 | } | |
54 | ||
55 | self->direction = dir; | |
56 | self->padlen = 0; | |
57 | } | |
58 | ||
59 | SV * | |
60 | _encrypt(Crypt::Mode::CBC self, SV * data) | |
61 | CODE: | |
62 | { | |
63 | int rv, has_tmp_block, blen; | |
64 | unsigned long i; | |
65 | ||
66 | STRLEN in_data_len, in_data_start; | |
67 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
68 | ||
69 | if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction); | |
70 | ||
71 | blen = (&self->state)->blocklen; | |
72 | in_data_start = 0; | |
73 | has_tmp_block = 0; | |
74 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
75 | if (in_data_len==0) { | |
76 | RETVAL = newSVpvn("", 0); | |
77 | } | |
78 | else { | |
79 | if(self->padlen > 0) { | |
80 | i = (blen - self->padlen); | |
81 | if (in_data_len >= i) { /* enough data to fill pad */ | |
82 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
83 | in_data_len -= i; | |
84 | in_data_start = i; | |
85 | rv = cbc_encrypt(self->pad, tmp_block, blen, &self->state); | |
86 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
87 | self->padlen = 0; | |
88 | has_tmp_block = 1; | |
89 | } | |
90 | else { /* not enough data to fill pad */ | |
91 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
92 | self->padlen += (int)in_data_len; | |
93 | in_data_len = 0; | |
94 | } | |
95 | } /* padlen > 0 */ | |
96 | ||
97 | i = (unsigned long)(in_data_len % blen); | |
98 | if (in_data_len>0 && i>0) { /* save tail of data into pad */ | |
99 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
100 | self->padlen = i; | |
101 | in_data_len -= i; | |
102 | } | |
103 | ||
104 | if (in_data_len>0) { | |
105 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
106 | RETVAL = NEWSV(0, i); | |
107 | SvPOK_only(RETVAL); | |
108 | SvCUR_set(RETVAL, i); | |
109 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
110 | ||
111 | if (has_tmp_block) { | |
112 | Copy(tmp_block, out_data, blen, unsigned char); | |
113 | out_data += blen; | |
114 | } | |
115 | rv = cbc_encrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
116 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
117 | } /* in_data_len>0 */ | |
118 | else if (has_tmp_block) { | |
119 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
120 | } | |
121 | else { | |
122 | RETVAL = newSVpvn("", 0); | |
123 | } | |
124 | } | |
125 | } | |
126 | OUTPUT: | |
127 | RETVAL | |
128 | ||
129 | SV * | |
130 | _finish_enc(Crypt::Mode::CBC self) | |
131 | CODE: | |
132 | { | |
133 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
134 | int rv, blen, i, j; | |
135 | ||
136 | blen = (&self->state)->blocklen; | |
137 | if (self->padlen<0 || self->padlen>=blen) croak("FATAL: invalid padlen"); | |
138 | ||
139 | if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
140 | i = blen - self->padlen; | |
141 | if (i == 0) i = blen; | |
142 | for(j=self->padlen; j<blen; j++) self->pad[j] = (unsigned char)i; | |
143 | rv = cbc_encrypt(self->pad, tmp_block, blen, &self->state); | |
144 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
145 | } | |
146 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
147 | self->pad[self->padlen] = 0x80; | |
148 | for(j=self->padlen+1; j<blen; j++) self->pad[j] = 0; | |
149 | rv = cbc_encrypt(self->pad, tmp_block, blen, &self->state); | |
150 | if (rv != CRYPT_OK) croak("FATAL: cbc_encrypt failed: %s", error_to_string(rv)); | |
151 | } | |
152 | else { | |
153 | if (self->padlen>0) croak("FATAL: cbc_encrypt, input data length not multiple of %d", blen); | |
154 | blen = 0; | |
155 | } | |
156 | ||
157 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
158 | } | |
159 | OUTPUT: | |
160 | RETVAL | |
161 | ||
162 | SV * | |
163 | _decrypt(Crypt::Mode::CBC self, SV * data) | |
164 | CODE: | |
165 | { | |
166 | int rv, has_tmp_block, blen; | |
167 | unsigned long i; | |
168 | STRLEN in_data_len, in_data_start; | |
169 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
170 | ||
171 | if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction); | |
172 | ||
173 | blen = (&self->state)->blocklen; | |
174 | in_data_start = 0; | |
175 | has_tmp_block = 0; | |
176 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
177 | if (in_data_len==0) { | |
178 | RETVAL = newSVpvn("", 0); | |
179 | } | |
180 | else { | |
181 | ||
182 | if(self->padlen == blen) { | |
183 | rv = cbc_decrypt(self->pad, tmp_block, blen, &self->state); | |
184 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
185 | self->padlen = 0; | |
186 | has_tmp_block = 1; | |
187 | } /* padlen == blen */ | |
188 | else if(self->padlen > 0) { | |
189 | i = (blen - self->padlen); /* remaining bytes in padding buffer */ | |
190 | if (in_data_len >= i) { /* enough data to fill pad */ | |
191 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
192 | self->padlen += i; | |
193 | in_data_len -= i; | |
194 | in_data_start = i; | |
195 | if (in_data_len>0 || self->padding_mode == 0) { | |
196 | rv = cbc_decrypt(self->pad, tmp_block, blen, &self->state); | |
197 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
198 | self->padlen = 0; | |
199 | has_tmp_block = 1; | |
200 | } | |
201 | } | |
202 | else { /* not enough data to fill pad */ | |
203 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
204 | self->padlen += (int)in_data_len; | |
205 | in_data_len = 0; | |
206 | } | |
207 | } /* padlen > 0 */ | |
208 | ||
209 | /* here: a/ padlen==1..16 && in_data_len==0; b/ padlen==0 && in_data_len>0 */ | |
210 | if (in_data_len>0) { | |
211 | i = (unsigned long)(in_data_len % blen); | |
212 | if (i>0) { /* save tail of data into pad */ | |
213 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
214 | self->padlen = i; | |
215 | in_data_len -= i; | |
216 | } | |
217 | } | |
218 | ||
219 | if (in_data_len>0) { | |
220 | if(self->padlen == 0 && self->padding_mode !=0) { | |
221 | /* in case of padding keep full pad if no more data */ | |
222 | Copy(in_data+in_data_start+in_data_len-blen, self->pad, blen, unsigned char); | |
223 | self->padlen = blen; | |
224 | in_data_len -= blen; | |
225 | } | |
226 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
227 | if (i == 0) { | |
228 | RETVAL = newSVpvn("", 0); | |
229 | } | |
230 | else { | |
231 | RETVAL = NEWSV(0, i); | |
232 | SvPOK_only(RETVAL); | |
233 | SvCUR_set(RETVAL, i); | |
234 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
235 | if (has_tmp_block) { | |
236 | Copy(tmp_block, out_data, blen, unsigned char); | |
237 | out_data += blen; | |
238 | } | |
239 | rv = cbc_decrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
240 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
241 | } | |
242 | } /* in_data_len>0 */ | |
243 | else if (has_tmp_block) { | |
244 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
245 | } | |
246 | else { | |
247 | RETVAL = newSVpvn("", 0); | |
248 | } | |
249 | } | |
250 | ||
251 | } | |
252 | OUTPUT: | |
253 | RETVAL | |
254 | ||
255 | SV * | |
256 | _finish_dec(Crypt::Mode::CBC self) | |
257 | CODE: | |
258 | { | |
259 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
260 | unsigned char i; | |
261 | int rv, rv_len, blen; | |
262 | ||
263 | rv_len = 0; | |
264 | if (self->padlen > 0) { | |
265 | blen = (&self->state)->blocklen; | |
266 | if (self->padlen != blen) croak("FATAL: cipher text length has to be multiple of %d (%d)", blen, self->padlen); | |
267 | rv = cbc_decrypt(self->pad, tmp_block, blen, &self->state); | |
268 | if (rv != CRYPT_OK) croak("FATAL: cbc_decrypt failed: %s", error_to_string(rv)); | |
269 | if(self->padding_mode == 0) { /* no padding */ | |
270 | rv_len = blen; | |
271 | } | |
272 | else if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
273 | i = tmp_block[blen-1]; | |
274 | rv_len = blen - (i>blen ? blen : i); | |
275 | } | |
276 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
277 | rv_len = blen; | |
278 | while ((unsigned char)tmp_block[rv_len-1] == 0x00) rv_len--; | |
279 | if ((unsigned char)tmp_block[rv_len-1] == 0x80) rv_len--; | |
280 | if (rv_len<0) rv_len = 0; | |
281 | } | |
282 | } | |
283 | RETVAL = newSVpvn((char*)tmp_block, rv_len); | |
284 | } | |
285 | OUTPUT: | |
286 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::CFB | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::CFB | |
5 | _new(char * cipher_name, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct cfb_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->direction = 0; | |
11 | RETVAL->cipher_rounds = rounds; | |
12 | RETVAL->cipher_id = find_cipher(cipher_name); | |
13 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
14 | } | |
15 | OUTPUT: | |
16 | RETVAL | |
17 | ||
18 | void | |
19 | DESTROY(Crypt::Mode::CFB self) | |
20 | CODE: | |
21 | Safefree(self); | |
22 | ||
23 | int | |
24 | _get_dir(Crypt::Mode::CFB self) | |
25 | CODE: | |
26 | RETVAL = self->direction; | |
27 | OUTPUT: | |
28 | RETVAL | |
29 | ||
30 | void | |
31 | _start(Crypt::Mode::CFB self, int dir, SV * key, SV * iv) | |
32 | CODE: | |
33 | { | |
34 | STRLEN k_len=0; | |
35 | unsigned char *k=NULL; | |
36 | STRLEN i_len=0; | |
37 | unsigned char *i=NULL; | |
38 | int rv; | |
39 | ||
40 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
41 | k = (unsigned char *) SvPVbyte(key, k_len); | |
42 | ||
43 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
44 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
45 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
46 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
47 | } | |
48 | ||
49 | rv = cfb_start(self->cipher_id, i, k, (int)k_len, self->cipher_rounds, &self->state); | |
50 | if (rv != CRYPT_OK) { | |
51 | croak("FATAL: cfb_start failed: %s", error_to_string(rv)); | |
52 | } | |
53 | ||
54 | self->direction = dir; | |
55 | } | |
56 | ||
57 | SV * | |
58 | _crypt(Crypt::Mode::CFB self, SV * data) | |
59 | CODE: | |
60 | { | |
61 | int rv; | |
62 | STRLEN in_data_len; | |
63 | unsigned char *in_data, *out_data; | |
64 | ||
65 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
66 | if (in_data_len==0) { | |
67 | RETVAL = newSVpvn("", 0); | |
68 | } | |
69 | else { | |
70 | RETVAL = NEWSV(0, in_data_len); | |
71 | SvPOK_only(RETVAL); | |
72 | SvCUR_set(RETVAL, in_data_len); | |
73 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
74 | ||
75 | if (self->direction == 1) { | |
76 | rv = cfb_encrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
77 | if (rv != CRYPT_OK) croak("FATAL: cfb_encrypt failed: %s", error_to_string(rv)); | |
78 | } | |
79 | else if (self->direction == -1) { | |
80 | rv = cfb_decrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
81 | if (rv != CRYPT_OK) croak("FATAL: cfb_decrypt failed: %s", error_to_string(rv)); | |
82 | } | |
83 | else { | |
84 | croak("FATAL: cfb_crypt failed: call start() first"); | |
85 | } | |
86 | } | |
87 | } | |
88 | OUTPUT: | |
89 | RETVAL | |
90 | ||
91 | SV * | |
92 | _finish(Crypt::Mode::CFB self) | |
93 | CODE: | |
94 | self->direction = 0; | |
95 | RETVAL = newSVpvn("", 0); | |
96 | OUTPUT: | |
97 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::CFB | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::CFB | |
5 | _new(char * cipher_name, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct cfb_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->direction = 0; | |
11 | RETVAL->cipher_rounds = rounds; | |
12 | RETVAL->cipher_id = find_cipher(cipher_name); | |
13 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
14 | } | |
15 | OUTPUT: | |
16 | RETVAL | |
17 | ||
18 | void | |
19 | DESTROY(Crypt::Mode::CFB self) | |
20 | CODE: | |
21 | Safefree(self); | |
22 | ||
23 | int | |
24 | _get_dir(Crypt::Mode::CFB self) | |
25 | CODE: | |
26 | RETVAL = self->direction; | |
27 | OUTPUT: | |
28 | RETVAL | |
29 | ||
30 | void | |
31 | _start(Crypt::Mode::CFB self, int dir, SV * key, SV * iv) | |
32 | CODE: | |
33 | { | |
34 | STRLEN k_len=0; | |
35 | unsigned char *k=NULL; | |
36 | STRLEN i_len=0; | |
37 | unsigned char *i=NULL; | |
38 | int rv; | |
39 | ||
40 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
41 | k = (unsigned char *) SvPVbyte(key, k_len); | |
42 | ||
43 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
44 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
45 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
46 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
47 | } | |
48 | ||
49 | rv = cfb_start(self->cipher_id, i, k, (int)k_len, self->cipher_rounds, &self->state); | |
50 | if (rv != CRYPT_OK) { | |
51 | croak("FATAL: cfb_start failed: %s", error_to_string(rv)); | |
52 | } | |
53 | ||
54 | self->direction = dir; | |
55 | } | |
56 | ||
57 | SV * | |
58 | _crypt(Crypt::Mode::CFB self, SV * data) | |
59 | CODE: | |
60 | { | |
61 | int rv; | |
62 | STRLEN in_data_len; | |
63 | unsigned char *in_data, *out_data; | |
64 | ||
65 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
66 | if (in_data_len==0) { | |
67 | RETVAL = newSVpvn("", 0); | |
68 | } | |
69 | else { | |
70 | RETVAL = NEWSV(0, in_data_len); | |
71 | SvPOK_only(RETVAL); | |
72 | SvCUR_set(RETVAL, in_data_len); | |
73 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
74 | ||
75 | if (self->direction == 1) { | |
76 | rv = cfb_encrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
77 | if (rv != CRYPT_OK) croak("FATAL: cfb_encrypt failed: %s", error_to_string(rv)); | |
78 | } | |
79 | else if (self->direction == -1) { | |
80 | rv = cfb_decrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
81 | if (rv != CRYPT_OK) croak("FATAL: cfb_decrypt failed: %s", error_to_string(rv)); | |
82 | } | |
83 | else { | |
84 | croak("FATAL: cfb_crypt failed: call start() first"); | |
85 | } | |
86 | } | |
87 | } | |
88 | OUTPUT: | |
89 | RETVAL | |
90 | ||
91 | SV * | |
92 | _finish(Crypt::Mode::CFB self) | |
93 | CODE: | |
94 | self->direction = 0; | |
95 | RETVAL = newSVpvn("", 0); | |
96 | OUTPUT: | |
97 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::CTR | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::CTR | |
5 | _new(char * cipher_name, int ctr_mode=0, int ctr_width=0, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct ctr_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->direction = 0; | |
11 | RETVAL->cipher_rounds = rounds; | |
12 | RETVAL->cipher_id = find_cipher(cipher_name); | |
13 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
14 | if (ctr_mode == 0) RETVAL->ctr_mode_param = CTR_COUNTER_LITTLE_ENDIAN; | |
15 | if (ctr_mode == 1) RETVAL->ctr_mode_param = CTR_COUNTER_BIG_ENDIAN; | |
16 | if (ctr_mode == 2) RETVAL->ctr_mode_param = CTR_COUNTER_LITTLE_ENDIAN|LTC_CTR_RFC3686; | |
17 | if (ctr_mode == 3) RETVAL->ctr_mode_param = CTR_COUNTER_BIG_ENDIAN|LTC_CTR_RFC3686; | |
18 | if (ctr_width > 0 && ctr_width <= cipher_descriptor[RETVAL->cipher_id].block_length) RETVAL->ctr_mode_param |= ctr_width; | |
19 | } | |
20 | OUTPUT: | |
21 | RETVAL | |
22 | ||
23 | void | |
24 | DESTROY(Crypt::Mode::CTR self) | |
25 | CODE: | |
26 | Safefree(self); | |
27 | ||
28 | int | |
29 | _get_dir(Crypt::Mode::CTR self) | |
30 | CODE: | |
31 | RETVAL = self->direction; | |
32 | OUTPUT: | |
33 | RETVAL | |
34 | ||
35 | void | |
36 | _start(Crypt::Mode::CTR self, int dir, SV * key, SV * iv) | |
37 | CODE: | |
38 | { | |
39 | STRLEN k_len=0; | |
40 | unsigned char *k=NULL; | |
41 | STRLEN i_len=0; | |
42 | unsigned char *i=NULL; | |
43 | int rv; | |
44 | ||
45 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
46 | k = (unsigned char *) SvPVbyte(key, k_len); | |
47 | ||
48 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
49 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
50 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
51 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
52 | } | |
53 | ||
54 | rv = ctr_start(self->cipher_id, i, k, (int)k_len, self->cipher_rounds, self->ctr_mode_param, &self->state); | |
55 | if (rv != CRYPT_OK) { | |
56 | croak("FATAL: ctr_start failed: %s", error_to_string(rv)); | |
57 | } | |
58 | ||
59 | self->direction = dir; | |
60 | } | |
61 | ||
62 | SV * | |
63 | _crypt(Crypt::Mode::CTR self, SV * data) | |
64 | CODE: | |
65 | { | |
66 | int rv; | |
67 | STRLEN in_data_len; | |
68 | unsigned char *in_data, *out_data; | |
69 | ||
70 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
71 | if (in_data_len==0) { | |
72 | RETVAL = newSVpvn("", 0); | |
73 | } | |
74 | else { | |
75 | RETVAL = NEWSV(0, in_data_len); | |
76 | SvPOK_only(RETVAL); | |
77 | SvCUR_set(RETVAL, in_data_len); | |
78 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
79 | ||
80 | if (self->direction == 1) { | |
81 | rv = ctr_encrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
82 | if (rv != CRYPT_OK) croak("FATAL: ctr_encrypt failed: %s", error_to_string(rv)); | |
83 | } | |
84 | else if (self->direction == -1) { | |
85 | rv = ctr_decrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
86 | if (rv != CRYPT_OK) croak("FATAL: ctr_decrypt failed: %s", error_to_string(rv)); | |
87 | } | |
88 | else { | |
89 | croak("FATAL: ctr_crypt failed: call start() first"); | |
90 | } | |
91 | } | |
92 | } | |
93 | OUTPUT: | |
94 | RETVAL | |
95 | ||
96 | SV * | |
97 | _finish(Crypt::Mode::CTR self) | |
98 | CODE: | |
99 | self->direction = 0; | |
100 | RETVAL = newSVpvn("", 0); | |
101 | OUTPUT: | |
102 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::CTR | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::CTR | |
5 | _new(char * cipher_name, int ctr_mode=0, int ctr_width=0, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct ctr_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->direction = 0; | |
11 | RETVAL->cipher_rounds = rounds; | |
12 | RETVAL->cipher_id = find_cipher(cipher_name); | |
13 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
14 | if (ctr_mode == 0) RETVAL->ctr_mode_param = CTR_COUNTER_LITTLE_ENDIAN; | |
15 | if (ctr_mode == 1) RETVAL->ctr_mode_param = CTR_COUNTER_BIG_ENDIAN; | |
16 | if (ctr_mode == 2) RETVAL->ctr_mode_param = CTR_COUNTER_LITTLE_ENDIAN|LTC_CTR_RFC3686; | |
17 | if (ctr_mode == 3) RETVAL->ctr_mode_param = CTR_COUNTER_BIG_ENDIAN|LTC_CTR_RFC3686; | |
18 | if (ctr_width > 0 && ctr_width <= cipher_descriptor[RETVAL->cipher_id].block_length) RETVAL->ctr_mode_param |= ctr_width; | |
19 | } | |
20 | OUTPUT: | |
21 | RETVAL | |
22 | ||
23 | void | |
24 | DESTROY(Crypt::Mode::CTR self) | |
25 | CODE: | |
26 | Safefree(self); | |
27 | ||
28 | int | |
29 | _get_dir(Crypt::Mode::CTR self) | |
30 | CODE: | |
31 | RETVAL = self->direction; | |
32 | OUTPUT: | |
33 | RETVAL | |
34 | ||
35 | void | |
36 | _start(Crypt::Mode::CTR self, int dir, SV * key, SV * iv) | |
37 | CODE: | |
38 | { | |
39 | STRLEN k_len=0; | |
40 | unsigned char *k=NULL; | |
41 | STRLEN i_len=0; | |
42 | unsigned char *i=NULL; | |
43 | int rv; | |
44 | ||
45 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
46 | k = (unsigned char *) SvPVbyte(key, k_len); | |
47 | ||
48 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
49 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
50 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
51 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
52 | } | |
53 | ||
54 | rv = ctr_start(self->cipher_id, i, k, (int)k_len, self->cipher_rounds, self->ctr_mode_param, &self->state); | |
55 | if (rv != CRYPT_OK) { | |
56 | croak("FATAL: ctr_start failed: %s", error_to_string(rv)); | |
57 | } | |
58 | ||
59 | self->direction = dir; | |
60 | } | |
61 | ||
62 | SV * | |
63 | _crypt(Crypt::Mode::CTR self, SV * data) | |
64 | CODE: | |
65 | { | |
66 | int rv; | |
67 | STRLEN in_data_len; | |
68 | unsigned char *in_data, *out_data; | |
69 | ||
70 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
71 | if (in_data_len==0) { | |
72 | RETVAL = newSVpvn("", 0); | |
73 | } | |
74 | else { | |
75 | RETVAL = NEWSV(0, in_data_len); | |
76 | SvPOK_only(RETVAL); | |
77 | SvCUR_set(RETVAL, in_data_len); | |
78 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
79 | ||
80 | if (self->direction == 1) { | |
81 | rv = ctr_encrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
82 | if (rv != CRYPT_OK) croak("FATAL: ctr_encrypt failed: %s", error_to_string(rv)); | |
83 | } | |
84 | else if (self->direction == -1) { | |
85 | rv = ctr_decrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
86 | if (rv != CRYPT_OK) croak("FATAL: ctr_decrypt failed: %s", error_to_string(rv)); | |
87 | } | |
88 | else { | |
89 | croak("FATAL: ctr_crypt failed: call start() first"); | |
90 | } | |
91 | } | |
92 | } | |
93 | OUTPUT: | |
94 | RETVAL | |
95 | ||
96 | SV * | |
97 | _finish(Crypt::Mode::CTR self) | |
98 | CODE: | |
99 | self->direction = 0; | |
100 | RETVAL = newSVpvn("", 0); | |
101 | OUTPUT: | |
102 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::ECB | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::ECB | |
5 | _new(char * cipher_name, int padding=1, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct ecb_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->padding_mode = padding; | |
11 | RETVAL->padlen = 0; | |
12 | RETVAL->direction = 0; | |
13 | RETVAL->cipher_rounds = rounds; | |
14 | RETVAL->cipher_id = find_cipher(cipher_name); | |
15 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
16 | } | |
17 | OUTPUT: | |
18 | RETVAL | |
19 | ||
20 | void | |
21 | DESTROY(Crypt::Mode::ECB self) | |
22 | CODE: | |
23 | Safefree(self); | |
24 | ||
25 | int | |
26 | _get_dir(Crypt::Mode::ECB self) | |
27 | CODE: | |
28 | RETVAL = self->direction; | |
29 | OUTPUT: | |
30 | RETVAL | |
31 | ||
32 | void | |
33 | _start(Crypt::Mode::ECB self, int dir, SV * key) | |
34 | CODE: | |
35 | { | |
36 | int rv; | |
37 | STRLEN k_len=0; | |
38 | unsigned char *k=NULL; | |
39 | ||
40 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
41 | k = (unsigned char *) SvPVbyte(key, k_len); | |
42 | ||
43 | rv = ecb_start(self->cipher_id, k, (unsigned long)k_len, self->cipher_rounds, &self->state); | |
44 | if (rv != CRYPT_OK) { | |
45 | croak("FATAL: ecb_start failed: %s", error_to_string(rv)); | |
46 | } | |
47 | ||
48 | self->direction = dir; | |
49 | self->padlen = 0; | |
50 | } | |
51 | ||
52 | SV * | |
53 | _encrypt(Crypt::Mode::ECB self, SV * data) | |
54 | CODE: | |
55 | { | |
56 | int rv, has_tmp_block, blen; | |
57 | unsigned long i; | |
58 | ||
59 | STRLEN in_data_len, in_data_start; | |
60 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
61 | ||
62 | if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction); | |
63 | ||
64 | blen = (&self->state)->blocklen; | |
65 | in_data_start = 0; | |
66 | has_tmp_block = 0; | |
67 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
68 | if (in_data_len==0) { | |
69 | RETVAL = newSVpvn("", 0); | |
70 | } | |
71 | else { | |
72 | if(self->padlen > 0) { | |
73 | i = (blen - self->padlen); | |
74 | if (in_data_len >= i) { /* enough data to fill pad */ | |
75 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
76 | in_data_len -= i; | |
77 | in_data_start = i; | |
78 | rv = ecb_encrypt(self->pad, tmp_block, blen, &self->state); | |
79 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
80 | self->padlen = 0; | |
81 | has_tmp_block = 1; | |
82 | } | |
83 | else { /* not enough data to fill pad */ | |
84 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
85 | self->padlen += (int)in_data_len; | |
86 | in_data_len = 0; | |
87 | } | |
88 | } /* padlen > 0 */ | |
89 | ||
90 | i = (unsigned long)(in_data_len % blen); | |
91 | if (in_data_len>0 && i>0) { /* save tail of data into pad */ | |
92 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
93 | self->padlen = i; | |
94 | in_data_len -= i; | |
95 | } | |
96 | ||
97 | if (in_data_len>0) { | |
98 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
99 | RETVAL = NEWSV(0, i); | |
100 | SvPOK_only(RETVAL); | |
101 | SvCUR_set(RETVAL, i); | |
102 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
103 | ||
104 | if (has_tmp_block) { | |
105 | Copy(tmp_block, out_data, blen, unsigned char); | |
106 | out_data += blen; | |
107 | } | |
108 | rv = ecb_encrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
109 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
110 | } /* in_data_len>0 */ | |
111 | else if (has_tmp_block) { | |
112 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
113 | } | |
114 | else { | |
115 | RETVAL = newSVpvn("", 0); | |
116 | } | |
117 | } | |
118 | } | |
119 | OUTPUT: | |
120 | RETVAL | |
121 | ||
122 | SV * | |
123 | _finish_enc(Crypt::Mode::ECB self) | |
124 | CODE: | |
125 | { | |
126 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
127 | int rv, blen, i, j; | |
128 | ||
129 | blen = (&self->state)->blocklen; | |
130 | if (self->padlen<0 || self->padlen>=blen) croak("FATAL: invalid padlen"); | |
131 | ||
132 | if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
133 | i = blen - self->padlen; | |
134 | if (i == 0) i = blen; | |
135 | for(j=self->padlen; j<blen; j++) self->pad[j] = (unsigned char)i; | |
136 | rv = ecb_encrypt(self->pad, tmp_block, blen, &self->state); | |
137 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
138 | } | |
139 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
140 | self->pad[self->padlen] = 0x80; | |
141 | for(j=self->padlen+1; j<blen; j++) self->pad[j] = 0; | |
142 | rv = ecb_encrypt(self->pad, tmp_block, blen, &self->state); | |
143 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
144 | } | |
145 | else { | |
146 | if (self->padlen>0) croak("FATAL: ecb_encrypt, input data length not multiple of %d", blen); | |
147 | blen = 0; | |
148 | } | |
149 | ||
150 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
151 | } | |
152 | OUTPUT: | |
153 | RETVAL | |
154 | ||
155 | SV * | |
156 | _decrypt(Crypt::Mode::ECB self, SV * data) | |
157 | CODE: | |
158 | { | |
159 | int rv, has_tmp_block, blen; | |
160 | unsigned long i; | |
161 | STRLEN in_data_len, in_data_start; | |
162 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
163 | ||
164 | if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction); | |
165 | ||
166 | blen = (&self->state)->blocklen; | |
167 | in_data_start = 0; | |
168 | has_tmp_block = 0; | |
169 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
170 | if (in_data_len==0) { | |
171 | RETVAL = newSVpvn("", 0); | |
172 | } | |
173 | else { | |
174 | ||
175 | if(self->padlen == blen) { | |
176 | rv = ecb_decrypt(self->pad, tmp_block, blen, &self->state); | |
177 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
178 | self->padlen = 0; | |
179 | has_tmp_block = 1; | |
180 | } /* padlen == blen */ | |
181 | else if(self->padlen > 0) { | |
182 | i = (blen - self->padlen); /* remaining bytes in padding buffer */ | |
183 | if (in_data_len >= i) { /* enough data to fill pad */ | |
184 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
185 | self->padlen += i; | |
186 | in_data_len -= i; | |
187 | in_data_start = i; | |
188 | if (in_data_len>0 || self->padding_mode == 0) { | |
189 | rv = ecb_decrypt(self->pad, tmp_block, blen, &self->state); | |
190 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
191 | self->padlen = 0; | |
192 | has_tmp_block = 1; | |
193 | } | |
194 | } | |
195 | else { /* not enough data to fill pad */ | |
196 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
197 | self->padlen += (int)in_data_len; | |
198 | in_data_len = 0; | |
199 | } | |
200 | } /* padlen > 0 */ | |
201 | ||
202 | /* here: a/ padlen==1..16 && in_data_len==0; b/ padlen==0 && in_data_len>0 */ | |
203 | if (in_data_len>0) { | |
204 | i = (unsigned long)(in_data_len % blen); | |
205 | if (i>0) { /* save tail of data into pad */ | |
206 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
207 | self->padlen = i; | |
208 | in_data_len -= i; | |
209 | } | |
210 | } | |
211 | ||
212 | if (in_data_len>0) { | |
213 | if(self->padlen == 0 && self->padding_mode !=0) { | |
214 | /* in case of padding keep full pad if no more data */ | |
215 | Copy(in_data+in_data_start+in_data_len-blen, self->pad, blen, unsigned char); | |
216 | self->padlen = blen; | |
217 | in_data_len -= blen; | |
218 | } | |
219 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
220 | if (i == 0) { | |
221 | RETVAL = newSVpvn("", 0); | |
222 | } | |
223 | else { | |
224 | RETVAL = NEWSV(0, i); | |
225 | SvPOK_only(RETVAL); | |
226 | SvCUR_set(RETVAL, i); | |
227 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
228 | if (has_tmp_block) { | |
229 | Copy(tmp_block, out_data, blen, unsigned char); | |
230 | out_data += blen; | |
231 | } | |
232 | rv = ecb_decrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
233 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
234 | } | |
235 | } /* in_data_len>0 */ | |
236 | else if (has_tmp_block) { | |
237 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
238 | } | |
239 | else { | |
240 | RETVAL = newSVpvn("", 0); | |
241 | } | |
242 | } | |
243 | ||
244 | } | |
245 | OUTPUT: | |
246 | RETVAL | |
247 | ||
248 | SV * | |
249 | _finish_dec(Crypt::Mode::ECB self) | |
250 | CODE: | |
251 | { | |
252 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
253 | unsigned char i; | |
254 | int rv, rv_len, blen; | |
255 | ||
256 | rv_len = 0; | |
257 | if (self->padlen > 0) { | |
258 | blen = (&self->state)->blocklen; | |
259 | if (self->padlen != blen) croak("FATAL: cipher text length has to be multiple of %d (%d)", blen, self->padlen); | |
260 | rv = ecb_decrypt(self->pad, tmp_block, blen, &self->state); | |
261 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
262 | if(self->padding_mode == 0) { /* no padding */ | |
263 | rv_len = blen; | |
264 | } | |
265 | else if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
266 | i = tmp_block[blen-1]; | |
267 | rv_len = blen - (i>blen ? blen : i); | |
268 | } | |
269 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
270 | rv_len = blen; | |
271 | while ((unsigned char)tmp_block[rv_len-1] == 0x00) rv_len--; | |
272 | if ((unsigned char)tmp_block[rv_len-1] == 0x80) rv_len--; | |
273 | if (rv_len<0) rv_len = 0; | |
274 | } | |
275 | } | |
276 | RETVAL = newSVpvn((char*)tmp_block, rv_len); | |
277 | } | |
278 | OUTPUT: | |
279 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::ECB | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::ECB | |
5 | _new(char * cipher_name, int padding=1, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct ecb_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->padding_mode = padding; | |
11 | RETVAL->padlen = 0; | |
12 | RETVAL->direction = 0; | |
13 | RETVAL->cipher_rounds = rounds; | |
14 | RETVAL->cipher_id = find_cipher(cipher_name); | |
15 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
16 | } | |
17 | OUTPUT: | |
18 | RETVAL | |
19 | ||
20 | void | |
21 | DESTROY(Crypt::Mode::ECB self) | |
22 | CODE: | |
23 | Safefree(self); | |
24 | ||
25 | int | |
26 | _get_dir(Crypt::Mode::ECB self) | |
27 | CODE: | |
28 | RETVAL = self->direction; | |
29 | OUTPUT: | |
30 | RETVAL | |
31 | ||
32 | void | |
33 | _start(Crypt::Mode::ECB self, int dir, SV * key) | |
34 | CODE: | |
35 | { | |
36 | int rv; | |
37 | STRLEN k_len=0; | |
38 | unsigned char *k=NULL; | |
39 | ||
40 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
41 | k = (unsigned char *) SvPVbyte(key, k_len); | |
42 | ||
43 | rv = ecb_start(self->cipher_id, k, (unsigned long)k_len, self->cipher_rounds, &self->state); | |
44 | if (rv != CRYPT_OK) { | |
45 | croak("FATAL: ecb_start failed: %s", error_to_string(rv)); | |
46 | } | |
47 | ||
48 | self->direction = dir; | |
49 | self->padlen = 0; | |
50 | } | |
51 | ||
52 | SV * | |
53 | _encrypt(Crypt::Mode::ECB self, SV * data) | |
54 | CODE: | |
55 | { | |
56 | int rv, has_tmp_block, blen; | |
57 | unsigned long i; | |
58 | ||
59 | STRLEN in_data_len, in_data_start; | |
60 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
61 | ||
62 | if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction); | |
63 | ||
64 | blen = (&self->state)->blocklen; | |
65 | in_data_start = 0; | |
66 | has_tmp_block = 0; | |
67 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
68 | if (in_data_len==0) { | |
69 | RETVAL = newSVpvn("", 0); | |
70 | } | |
71 | else { | |
72 | if(self->padlen > 0) { | |
73 | i = (blen - self->padlen); | |
74 | if (in_data_len >= i) { /* enough data to fill pad */ | |
75 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
76 | in_data_len -= i; | |
77 | in_data_start = i; | |
78 | rv = ecb_encrypt(self->pad, tmp_block, blen, &self->state); | |
79 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
80 | self->padlen = 0; | |
81 | has_tmp_block = 1; | |
82 | } | |
83 | else { /* not enough data to fill pad */ | |
84 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
85 | self->padlen += (int)in_data_len; | |
86 | in_data_len = 0; | |
87 | } | |
88 | } /* padlen > 0 */ | |
89 | ||
90 | i = (unsigned long)(in_data_len % blen); | |
91 | if (in_data_len>0 && i>0) { /* save tail of data into pad */ | |
92 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
93 | self->padlen = i; | |
94 | in_data_len -= i; | |
95 | } | |
96 | ||
97 | if (in_data_len>0) { | |
98 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
99 | RETVAL = NEWSV(0, i); | |
100 | SvPOK_only(RETVAL); | |
101 | SvCUR_set(RETVAL, i); | |
102 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
103 | ||
104 | if (has_tmp_block) { | |
105 | Copy(tmp_block, out_data, blen, unsigned char); | |
106 | out_data += blen; | |
107 | } | |
108 | rv = ecb_encrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
109 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
110 | } /* in_data_len>0 */ | |
111 | else if (has_tmp_block) { | |
112 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
113 | } | |
114 | else { | |
115 | RETVAL = newSVpvn("", 0); | |
116 | } | |
117 | } | |
118 | } | |
119 | OUTPUT: | |
120 | RETVAL | |
121 | ||
122 | SV * | |
123 | _finish_enc(Crypt::Mode::ECB self) | |
124 | CODE: | |
125 | { | |
126 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
127 | int rv, blen, i, j; | |
128 | ||
129 | blen = (&self->state)->blocklen; | |
130 | if (self->padlen<0 || self->padlen>=blen) croak("FATAL: invalid padlen"); | |
131 | ||
132 | if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
133 | i = blen - self->padlen; | |
134 | if (i == 0) i = blen; | |
135 | for(j=self->padlen; j<blen; j++) self->pad[j] = (unsigned char)i; | |
136 | rv = ecb_encrypt(self->pad, tmp_block, blen, &self->state); | |
137 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
138 | } | |
139 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
140 | self->pad[self->padlen] = 0x80; | |
141 | for(j=self->padlen+1; j<blen; j++) self->pad[j] = 0; | |
142 | rv = ecb_encrypt(self->pad, tmp_block, blen, &self->state); | |
143 | if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); | |
144 | } | |
145 | else { | |
146 | if (self->padlen>0) croak("FATAL: ecb_encrypt, input data length not multiple of %d", blen); | |
147 | blen = 0; | |
148 | } | |
149 | ||
150 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
151 | } | |
152 | OUTPUT: | |
153 | RETVAL | |
154 | ||
155 | SV * | |
156 | _decrypt(Crypt::Mode::ECB self, SV * data) | |
157 | CODE: | |
158 | { | |
159 | int rv, has_tmp_block, blen; | |
160 | unsigned long i; | |
161 | STRLEN in_data_len, in_data_start; | |
162 | unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE]; | |
163 | ||
164 | if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction); | |
165 | ||
166 | blen = (&self->state)->blocklen; | |
167 | in_data_start = 0; | |
168 | has_tmp_block = 0; | |
169 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
170 | if (in_data_len==0) { | |
171 | RETVAL = newSVpvn("", 0); | |
172 | } | |
173 | else { | |
174 | ||
175 | if(self->padlen == blen) { | |
176 | rv = ecb_decrypt(self->pad, tmp_block, blen, &self->state); | |
177 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
178 | self->padlen = 0; | |
179 | has_tmp_block = 1; | |
180 | } /* padlen == blen */ | |
181 | else if(self->padlen > 0) { | |
182 | i = (blen - self->padlen); /* remaining bytes in padding buffer */ | |
183 | if (in_data_len >= i) { /* enough data to fill pad */ | |
184 | Copy(in_data, self->pad+self->padlen, i, unsigned char); | |
185 | self->padlen += i; | |
186 | in_data_len -= i; | |
187 | in_data_start = i; | |
188 | if (in_data_len>0 || self->padding_mode == 0) { | |
189 | rv = ecb_decrypt(self->pad, tmp_block, blen, &self->state); | |
190 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
191 | self->padlen = 0; | |
192 | has_tmp_block = 1; | |
193 | } | |
194 | } | |
195 | else { /* not enough data to fill pad */ | |
196 | Copy(in_data, self->pad+self->padlen, in_data_len, unsigned char); | |
197 | self->padlen += (int)in_data_len; | |
198 | in_data_len = 0; | |
199 | } | |
200 | } /* padlen > 0 */ | |
201 | ||
202 | /* here: a/ padlen==1..16 && in_data_len==0; b/ padlen==0 && in_data_len>0 */ | |
203 | if (in_data_len>0) { | |
204 | i = (unsigned long)(in_data_len % blen); | |
205 | if (i>0) { /* save tail of data into pad */ | |
206 | Copy(in_data+in_data_start+in_data_len-i, self->pad, i, unsigned char); | |
207 | self->padlen = i; | |
208 | in_data_len -= i; | |
209 | } | |
210 | } | |
211 | ||
212 | if (in_data_len>0) { | |
213 | if(self->padlen == 0 && self->padding_mode !=0) { | |
214 | /* in case of padding keep full pad if no more data */ | |
215 | Copy(in_data+in_data_start+in_data_len-blen, self->pad, blen, unsigned char); | |
216 | self->padlen = blen; | |
217 | in_data_len -= blen; | |
218 | } | |
219 | i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); | |
220 | if (i == 0) { | |
221 | RETVAL = newSVpvn("", 0); | |
222 | } | |
223 | else { | |
224 | RETVAL = NEWSV(0, i); | |
225 | SvPOK_only(RETVAL); | |
226 | SvCUR_set(RETVAL, i); | |
227 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
228 | if (has_tmp_block) { | |
229 | Copy(tmp_block, out_data, blen, unsigned char); | |
230 | out_data += blen; | |
231 | } | |
232 | rv = ecb_decrypt(in_data+in_data_start, out_data, (unsigned long)in_data_len, &self->state); | |
233 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
234 | } | |
235 | } /* in_data_len>0 */ | |
236 | else if (has_tmp_block) { | |
237 | RETVAL = newSVpvn((char*)tmp_block, blen); | |
238 | } | |
239 | else { | |
240 | RETVAL = newSVpvn("", 0); | |
241 | } | |
242 | } | |
243 | ||
244 | } | |
245 | OUTPUT: | |
246 | RETVAL | |
247 | ||
248 | SV * | |
249 | _finish_dec(Crypt::Mode::ECB self) | |
250 | CODE: | |
251 | { | |
252 | unsigned char tmp_block[MAXBLOCKSIZE]; | |
253 | unsigned char i; | |
254 | int rv, rv_len, blen; | |
255 | ||
256 | rv_len = 0; | |
257 | if (self->padlen > 0) { | |
258 | blen = (&self->state)->blocklen; | |
259 | if (self->padlen != blen) croak("FATAL: cipher text length has to be multiple of %d (%d)", blen, self->padlen); | |
260 | rv = ecb_decrypt(self->pad, tmp_block, blen, &self->state); | |
261 | if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); | |
262 | if(self->padding_mode == 0) { /* no padding */ | |
263 | rv_len = blen; | |
264 | } | |
265 | else if(self->padding_mode == 1) { /* pkcs5|7 padding */ | |
266 | i = tmp_block[blen-1]; | |
267 | rv_len = blen - (i>blen ? blen : i); | |
268 | } | |
269 | else if(self->padding_mode == 2) { /* oneandzeroes padding */ | |
270 | rv_len = blen; | |
271 | while ((unsigned char)tmp_block[rv_len-1] == 0x00) rv_len--; | |
272 | if ((unsigned char)tmp_block[rv_len-1] == 0x80) rv_len--; | |
273 | if (rv_len<0) rv_len = 0; | |
274 | } | |
275 | } | |
276 | RETVAL = newSVpvn((char*)tmp_block, rv_len); | |
277 | } | |
278 | OUTPUT: | |
279 | RETVAL |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::OFB | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::OFB | |
5 | _new(char * cipher_name, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct ofb_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->direction = 0; | |
11 | RETVAL->cipher_rounds = rounds; | |
12 | RETVAL->cipher_id = find_cipher(cipher_name); | |
13 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
14 | } | |
15 | OUTPUT: | |
16 | RETVAL | |
17 | ||
18 | void | |
19 | DESTROY(Crypt::Mode::OFB self) | |
20 | CODE: | |
21 | Safefree(self); | |
22 | ||
23 | int | |
24 | _get_dir(Crypt::Mode::OFB self) | |
25 | CODE: | |
26 | RETVAL = self->direction; | |
27 | OUTPUT: | |
28 | RETVAL | |
29 | ||
30 | void | |
31 | _start(Crypt::Mode::OFB self, int dir, SV * key, SV * iv) | |
32 | CODE: | |
33 | { | |
34 | STRLEN k_len=0; | |
35 | unsigned char *k=NULL; | |
36 | STRLEN i_len=0; | |
37 | unsigned char *i=NULL; | |
38 | int rv; | |
39 | ||
40 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
41 | k = (unsigned char *) SvPVbyte(key, k_len); | |
42 | ||
43 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
44 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
45 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
46 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
47 | } | |
48 | ||
49 | rv = ofb_start(self->cipher_id, i, k, (int)k_len, self->cipher_rounds, &self->state); | |
50 | if (rv != CRYPT_OK) { | |
51 | croak("FATAL: ofb_start failed: %s", error_to_string(rv)); | |
52 | } | |
53 | ||
54 | self->direction = dir; | |
55 | } | |
56 | ||
57 | SV * | |
58 | _crypt(Crypt::Mode::OFB self, SV * data) | |
59 | CODE: | |
60 | { | |
61 | int rv; | |
62 | STRLEN in_data_len; | |
63 | unsigned char *in_data, *out_data; | |
64 | ||
65 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
66 | if (in_data_len==0) { | |
67 | RETVAL = newSVpvn("", 0); | |
68 | } | |
69 | else { | |
70 | RETVAL = NEWSV(0, in_data_len); | |
71 | SvPOK_only(RETVAL); | |
72 | SvCUR_set(RETVAL, in_data_len); | |
73 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
74 | ||
75 | if (self->direction == 1) { | |
76 | rv = ofb_encrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
77 | if (rv != CRYPT_OK) croak("FATAL: ofb_encrypt failed: %s", error_to_string(rv)); | |
78 | } | |
79 | else if (self->direction == -1) { | |
80 | rv = ofb_decrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
81 | if (rv != CRYPT_OK) croak("FATAL: ofb_decrypt failed: %s", error_to_string(rv)); | |
82 | } | |
83 | else { | |
84 | croak("FATAL: ofb_crypt failed: call start() first"); | |
85 | } | |
86 | } | |
87 | } | |
88 | OUTPUT: | |
89 | RETVAL | |
90 | ||
91 | SV * | |
92 | _finish(Crypt::Mode::OFB self) | |
93 | CODE: | |
94 | self->direction = 0; | |
95 | RETVAL = newSVpvn("", 0); | |
96 | OUTPUT: | |
97 | RETVAL | |
0 | MODULE = CryptX PACKAGE = Crypt::Mode::OFB | |
1 | ||
2 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! | |
3 | ||
4 | Crypt::Mode::OFB | |
5 | _new(char * cipher_name, int rounds=0) | |
6 | CODE: | |
7 | { | |
8 | Newz(0, RETVAL, 1, struct ofb_struct); | |
9 | if (!RETVAL) croak("FATAL: Newz failed"); | |
10 | RETVAL->direction = 0; | |
11 | RETVAL->cipher_rounds = rounds; | |
12 | RETVAL->cipher_id = find_cipher(cipher_name); | |
13 | if(RETVAL->cipher_id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); | |
14 | } | |
15 | OUTPUT: | |
16 | RETVAL | |
17 | ||
18 | void | |
19 | DESTROY(Crypt::Mode::OFB self) | |
20 | CODE: | |
21 | Safefree(self); | |
22 | ||
23 | int | |
24 | _get_dir(Crypt::Mode::OFB self) | |
25 | CODE: | |
26 | RETVAL = self->direction; | |
27 | OUTPUT: | |
28 | RETVAL | |
29 | ||
30 | void | |
31 | _start(Crypt::Mode::OFB self, int dir, SV * key, SV * iv) | |
32 | CODE: | |
33 | { | |
34 | STRLEN k_len=0; | |
35 | unsigned char *k=NULL; | |
36 | STRLEN i_len=0; | |
37 | unsigned char *i=NULL; | |
38 | int rv; | |
39 | ||
40 | if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); | |
41 | k = (unsigned char *) SvPVbyte(key, k_len); | |
42 | ||
43 | if (!SvPOK(iv)) croak("FATAL: iv must be string/buffer scalar"); | |
44 | i = (unsigned char *) SvPVbyte(iv, i_len); | |
45 | if (i_len != (STRLEN)cipher_descriptor[self->cipher_id].block_length) { | |
46 | croak ("FATAL: sizeof(iv) should be equal to blocksize (%d)", cipher_descriptor[self->cipher_id].block_length); | |
47 | } | |
48 | ||
49 | rv = ofb_start(self->cipher_id, i, k, (int)k_len, self->cipher_rounds, &self->state); | |
50 | if (rv != CRYPT_OK) { | |
51 | croak("FATAL: ofb_start failed: %s", error_to_string(rv)); | |
52 | } | |
53 | ||
54 | self->direction = dir; | |
55 | } | |
56 | ||
57 | SV * | |
58 | _crypt(Crypt::Mode::OFB self, SV * data) | |
59 | CODE: | |
60 | { | |
61 | int rv; | |
62 | STRLEN in_data_len; | |
63 | unsigned char *in_data, *out_data; | |
64 | ||
65 | in_data = (unsigned char *)SvPVbyte(data, in_data_len); | |
66 | if (in_data_len==0) { | |
67 | RETVAL = newSVpvn("", 0); | |
68 | } | |
69 | else { | |
70 | RETVAL = NEWSV(0, in_data_len); | |
71 | SvPOK_only(RETVAL); | |
72 | SvCUR_set(RETVAL, in_data_len); | |
73 | out_data = (unsigned char *)SvPV_nolen(RETVAL); | |
74 | ||
75 | if (self->direction == 1) { | |
76 | rv = ofb_encrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
77 | if (rv != CRYPT_OK) croak("FATAL: ofb_encrypt failed: %s", error_to_string(rv)); | |
78 | } | |
79 | else if (self->direction == -1) { | |
80 | rv = ofb_decrypt(in_data, out_data, (unsigned long)in_data_len, &self->state); | |
81 | if (rv != CRYPT_OK) croak("FATAL: ofb_decrypt failed: %s", error_to_string(rv)); | |
82 | } | |
83 | else { | |
84 | croak("FATAL: ofb_crypt failed: call start() first"); | |
85 | } | |
86 | } | |
87 | } | |
88 | OUTPUT: | |
89 | RETVAL | |
90 | ||
91 | SV * | |
92 | _finish(Crypt::Mode::OFB self) | |
93 | CODE: | |
94 | self->direction = 0; | |
95 | RETVAL = newSVpvn("", 0); | |
96 | OUTPUT: | |
97 | RETVAL |