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