line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: IDEA.pm,v 1.7 2001/05/02 21:59:33 btrott Exp $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::SSH::Perl::Cipher::IDEA; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
8
|
use Net::SSH::Perl::Cipher; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
9
|
1
|
|
|
1
|
|
7
|
use base qw( Net::SSH::Perl::Cipher ); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
90
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
414
|
use Net::SSH::Perl::Cipher::CFB; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
12
|
1
|
|
|
1
|
|
461
|
use Crypt::IDEA; |
|
1
|
|
|
|
|
893
|
|
|
1
|
|
|
|
|
271
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
6
|
|
|
6
|
1
|
19
|
my $class = shift; |
16
|
6
|
|
|
|
|
190
|
my $ciph = bless { }, $class; |
17
|
6
|
50
|
|
|
|
38
|
$ciph->init(@_) if @_; |
18
|
6
|
|
|
|
|
222
|
$ciph; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init { |
22
|
6
|
|
|
6
|
0
|
12
|
my $ciph = shift; |
23
|
6
|
|
|
|
|
18
|
my($key, $iv) = @_; |
24
|
6
|
|
|
|
|
38
|
my $idea = IDEA->new(substr $key, 0, 16); |
25
|
6
|
|
|
|
|
142
|
$ciph->{cfb} = Net::SSH::Perl::Cipher::CFB->new($idea, $iv); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub encrypt { |
29
|
3
|
|
|
3
|
1
|
5511
|
my($ciph, $text) = @_; |
30
|
3
|
|
|
|
|
18
|
$ciph->{cfb}->encrypt($text); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub decrypt { |
34
|
3
|
|
|
3
|
1
|
22
|
my($ciph, $text) = @_; |
35
|
3
|
|
|
|
|
13
|
$ciph->{cfb}->decrypt($text); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |