line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Cipher::SAFER_SK64; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
697
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
45
|
|
6
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
65
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.080'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
9
|
use base qw(Crypt::Cipher); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
399
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
1
|
114
|
sub blocksize { Crypt::Cipher::blocksize('SAFER_SK64') } |
12
|
2
|
|
|
2
|
1
|
7
|
sub keysize { Crypt::Cipher::keysize('SAFER_SK64') } |
13
|
2
|
|
|
2
|
1
|
12
|
sub max_keysize { Crypt::Cipher::max_keysize('SAFER_SK64') } |
14
|
2
|
|
|
2
|
1
|
13
|
sub min_keysize { Crypt::Cipher::min_keysize('SAFER_SK64') } |
15
|
2
|
|
|
2
|
1
|
13
|
sub default_rounds { Crypt::Cipher::default_rounds('SAFER_SK64') } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=pod |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 NAME |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64 - Symmetric cipher SAFER_SK64, key size: 64 bits |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
### example 1 |
28
|
|
|
|
|
|
|
use Crypt::Mode::CBC; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $key = '...'; # length has to be valid key size for this cipher |
31
|
|
|
|
|
|
|
my $iv = '...'; # 16 bytes |
32
|
|
|
|
|
|
|
my $cbc = Crypt::Mode::CBC->new('SAFER_SK64'); |
33
|
|
|
|
|
|
|
my $ciphertext = $cbc->encrypt("secret data", $key, $iv); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
### example 2 (slower) |
36
|
|
|
|
|
|
|
use Crypt::CBC; |
37
|
|
|
|
|
|
|
use Crypt::Cipher::SAFER_SK64; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $key = '...'; # length has to be valid key size for this cipher |
40
|
|
|
|
|
|
|
my $iv = '...'; # 16 bytes |
41
|
|
|
|
|
|
|
my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK64', -key=>$key, -iv=>$iv ); |
42
|
|
|
|
|
|
|
my $ciphertext = $cbc->encrypt("secret data"); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This module implements the SAFER_SK64 cipher. Provided interface is compliant with L module. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to |
49
|
|
|
|
|
|
|
encrypt/decrypt generic data you have to use some of the cipher block modes - check for example |
50
|
|
|
|
|
|
|
L, L or L (which will be slower). |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 new |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$c = Crypt::Cipher::SAFER_SK64->new($key); |
57
|
|
|
|
|
|
|
#or |
58
|
|
|
|
|
|
|
$c = Crypt::Cipher::SAFER_SK64->new($key, $rounds); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 encrypt |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$ciphertext = $c->encrypt($plaintext); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 decrypt |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$plaintext = $c->decrypt($ciphertext); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 keysize |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$c->keysize; |
71
|
|
|
|
|
|
|
#or |
72
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64->keysize; |
73
|
|
|
|
|
|
|
#or |
74
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64::keysize; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 blocksize |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$c->blocksize; |
79
|
|
|
|
|
|
|
#or |
80
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64->blocksize; |
81
|
|
|
|
|
|
|
#or |
82
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64::blocksize; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 max_keysize |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$c->max_keysize; |
87
|
|
|
|
|
|
|
#or |
88
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64->max_keysize; |
89
|
|
|
|
|
|
|
#or |
90
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64::max_keysize; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 min_keysize |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$c->min_keysize; |
95
|
|
|
|
|
|
|
#or |
96
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64->min_keysize; |
97
|
|
|
|
|
|
|
#or |
98
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64::min_keysize; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 default_rounds |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$c->default_rounds; |
103
|
|
|
|
|
|
|
#or |
104
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64->default_rounds; |
105
|
|
|
|
|
|
|
#or |
106
|
|
|
|
|
|
|
Crypt::Cipher::SAFER_SK64::default_rounds; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SEE ALSO |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * L, L |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * L |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |