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