line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2001 Abhijit Menon-Sen |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Crypt::TEA; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
12931
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
52
|
|
7
|
1
|
|
|
1
|
|
6
|
use DynaLoader; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw( @ISA $VERSION ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
334
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
@ISA = qw( DynaLoader ); |
11
|
|
|
|
|
|
|
($VERSION) = q$Revision: 1.26 $ =~ /([\d.]+)/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
bootstrap Crypt::TEA $VERSION; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub keysize () { 16 } |
16
|
|
|
|
|
|
|
sub blocksize () { 8 } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new |
19
|
|
|
|
|
|
|
{ |
20
|
40003
|
|
|
40003
|
1
|
171729
|
my ($class, $key, $rounds) = @_; |
21
|
|
|
|
|
|
|
|
22
|
40003
|
50
|
|
|
|
71271
|
croak "Usage: ".__PACKAGE__."->new(\$key [, \$rounds])" unless $key; |
23
|
40003
|
|
50
|
|
|
152767
|
return Crypt::TEA::setup($key, $rounds || 32); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub encrypt |
27
|
|
|
|
|
|
|
{ |
28
|
70001
|
|
|
70001
|
1
|
251863
|
my ($self, $data) = @_; |
29
|
|
|
|
|
|
|
|
30
|
70001
|
50
|
33
|
|
|
200436
|
croak "Usage: \$cipher->encrypt(\$data)" unless ref($self) && $data; |
31
|
70001
|
|
|
|
|
215246
|
$self->crypt($data, $data, 0); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub decrypt |
35
|
|
|
|
|
|
|
{ |
36
|
70001
|
|
|
70001
|
1
|
246935
|
my ($self, $data) = @_; |
37
|
|
|
|
|
|
|
|
38
|
70001
|
50
|
33
|
|
|
196012
|
croak "Usage: \$cipher->decrypt(\$data)" unless ref($self) && $data; |
39
|
70001
|
|
|
|
|
212423
|
$self->crypt($data, $data, 1); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |