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