line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Perl::Cipher::DES; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Net::SSH::Perl::Cipher; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
4
|
use base qw( Net::SSH::Perl::Cipher ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use Net::SSH::Perl::Cipher::CBC; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
10
|
1
|
|
|
1
|
|
480
|
use Crypt::Cipher::DES; |
|
1
|
|
|
|
|
297
|
|
|
1
|
|
|
|
|
235
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
0
|
15
|
sub keysize { 8 } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
6
|
|
|
6
|
1
|
15
|
my $class = shift; |
16
|
6
|
|
|
|
|
18
|
my $ciph = bless { }, $class; |
17
|
6
|
50
|
|
|
|
29
|
$ciph->init(@_) if @_; |
18
|
6
|
|
|
|
|
22
|
$ciph; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init { |
22
|
6
|
|
|
6
|
0
|
10
|
my $ciph = shift; |
23
|
6
|
|
|
|
|
15
|
my($key, $iv) = @_; |
24
|
6
|
|
|
|
|
21
|
$key = substr($key,0,$ciph->keysize); |
25
|
6
|
|
|
|
|
196
|
my $des = Crypt::Cipher::DES->new($key); |
26
|
6
|
|
|
|
|
31
|
$ciph->{cbc} = Net::SSH::Perl::Cipher::CBC->new($des, $iv); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub encrypt { |
30
|
3
|
|
|
3
|
1
|
2437
|
my($ciph, $text) = @_; |
31
|
3
|
|
|
|
|
12
|
$ciph->{cbc}->encrypt($text); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub decrypt { |
35
|
3
|
|
|
3
|
1
|
15
|
my($ciph, $text) = @_; |
36
|
3
|
|
|
|
|
10
|
$ciph->{cbc}->decrypt($text); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
__END__ |