| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! /usr/local/bin/perl -w |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/) |
|
5
|
|
|
|
|
|
|
# All rights reserved. |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Crypt::IDEA; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION="1.10"; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
|
13
|
|
|
|
|
|
|
require DynaLoader; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@ISA = (Exporter, DynaLoader); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Items to export into callers namespace by default |
|
18
|
|
|
|
|
|
|
@EXPORT = qw(); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Other items we are prepared to export if requested |
|
21
|
|
|
|
|
|
|
@EXPORT_OK = qw(); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
bootstrap Crypt::IDEA; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$VERSION="1.10"; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package IDEA; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$VERSION="1.10"; |
|
30
|
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
590
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
32
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
388
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub usage |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
0
|
|
|
0
|
0
|
0
|
my ($mess, $package, $filename, $line, $subr); |
|
37
|
0
|
|
|
|
|
0
|
($mess) = @_; |
|
38
|
0
|
|
|
|
|
0
|
($package, $filename, $line, $subr) = caller(1); |
|
39
|
0
|
|
|
|
|
0
|
$Carp::CarpLevel = 2; |
|
40
|
0
|
|
|
|
|
0
|
croak "Usage: $package\::$subr - $mess"; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
11
|
|
|
11
|
1
|
6209
|
sub blocksize { 8; } |
|
45
|
11
|
|
|
11
|
1
|
48
|
sub keysize { 16; } |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub new |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
11
|
50
|
|
11
|
1
|
4013
|
usage("new IDEA key") unless @_ == 2; |
|
50
|
|
|
|
|
|
|
|
|
51
|
11
|
|
|
|
|
17
|
my $type = shift; my $self = {}; bless $self, $type; |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
24
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
11
|
|
|
|
|
1988
|
$self->{'ks'} = Crypt::IDEA::expand_key(shift); |
|
54
|
|
|
|
|
|
|
|
|
55
|
11
|
|
|
|
|
33
|
$self; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub encrypt |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
11
|
50
|
|
11
|
1
|
41
|
usage("encrypt data[8 bytes]") unless @_ == 2; |
|
61
|
|
|
|
|
|
|
|
|
62
|
11
|
|
|
|
|
16
|
my $self = shift; |
|
63
|
11
|
|
|
|
|
18
|
my $data = shift; |
|
64
|
|
|
|
|
|
|
|
|
65
|
11
|
|
|
|
|
58
|
Crypt::IDEA::crypt($data, $data, $self->{'ks'}); |
|
66
|
|
|
|
|
|
|
|
|
67
|
11
|
|
|
|
|
61
|
$data; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub decrypt |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
11
|
50
|
|
11
|
1
|
4320
|
usage("decrypt data[8 bytes]") unless @_ == 2; |
|
73
|
|
|
|
|
|
|
|
|
74
|
11
|
|
|
|
|
16
|
my $self = shift; |
|
75
|
11
|
|
|
|
|
37
|
my $data = shift; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# |
|
78
|
|
|
|
|
|
|
# Cache Decrypt key schedule |
|
79
|
|
|
|
|
|
|
# |
|
80
|
11
|
50
|
|
|
|
94
|
$self->{'dks'} = Crypt::IDEA::invert_key($self->{'ks'}) |
|
81
|
|
|
|
|
|
|
unless exists $self->{'dks'}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
11
|
|
|
|
|
38
|
Crypt::IDEA::crypt($data, $data, $self->{'dks'}); |
|
84
|
|
|
|
|
|
|
|
|
85
|
11
|
|
|
|
|
86
|
$data; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |