line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Stream::Sosemanuk; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
601
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
43
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.080'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
8
|
use CryptX; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
1; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=pod |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Crypt::Stream::Sosemanuk - Stream cipher Sosemanuk |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Crypt::Stream::Sosemanuk; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# encrypt |
22
|
|
|
|
|
|
|
$key = "1234567890123456"; |
23
|
|
|
|
|
|
|
$iv = "123456789012"; |
24
|
|
|
|
|
|
|
$stream = Crypt::Stream::Sosemanuk->new($key, $iv); |
25
|
|
|
|
|
|
|
$ct = $stream->crypt("plain message"); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# decrypt |
28
|
|
|
|
|
|
|
$key = "1234567890123456"; |
29
|
|
|
|
|
|
|
$iv = "123456789012"; |
30
|
|
|
|
|
|
|
$stream = Crypt::Stream::Sosemanuk->new($key, $iv); |
31
|
|
|
|
|
|
|
$pt = $stream->crypt($ct); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Provides an interface to the Sosemanuk stream cipher. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$stream = Crypt::Stream::Sosemanuk->new($key, $iv); |
42
|
|
|
|
|
|
|
# $key .. keylen must be multiple of 4 bytes |
43
|
|
|
|
|
|
|
# $iv .. ivlen must be multiple of 4 bytes (OPTIONAL) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 crypt |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$ciphertext = $stream->crypt($plaintext); |
48
|
|
|
|
|
|
|
#or |
49
|
|
|
|
|
|
|
$plaintext = $stream->crypt($ciphertext); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 keystream |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$random_key = $stream->keystream($length); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 clone |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$stream->clone(); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SEE ALSO |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=over |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item * L, L, L, L |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item * L |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |