| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::IPMessenger::EncryptOption; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
53
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
79
|
|
|
5
|
2
|
|
|
2
|
|
9
|
use overload '""' => \&get_option, fallback => 1; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
23
|
|
|
6
|
2
|
|
|
2
|
|
156
|
use Scalar::Util qw( looks_like_number ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
840
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTOLOAD; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %ENCRYPT_OPT = ( |
|
11
|
|
|
|
|
|
|
RSA_512 => 0x00000001, |
|
12
|
|
|
|
|
|
|
RSA_1024 => 0x00000002, |
|
13
|
|
|
|
|
|
|
RSA_2048 => 0x00000004, |
|
14
|
|
|
|
|
|
|
RC2_40 => 0x00001000, |
|
15
|
|
|
|
|
|
|
RC2_128 => 0x00004000, |
|
16
|
|
|
|
|
|
|
RC2_256 => 0x00008000, |
|
17
|
|
|
|
|
|
|
BLOWFISH_128 => 0x00020000, |
|
18
|
|
|
|
|
|
|
BLOWFISH_256 => 0x00040000, |
|
19
|
|
|
|
|
|
|
SIGN_MD5 => 0x10000000, |
|
20
|
|
|
|
|
|
|
RC2_40OLD => 0x00000010, |
|
21
|
|
|
|
|
|
|
RC2_128OLD => 0x00000040, |
|
22
|
|
|
|
|
|
|
BLOWFISH_128OLD => 0x00000400, |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
|
26
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
27
|
0
|
|
0
|
|
|
|
my $option = shift || 0; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
return unless looks_like_number($option); |
|
30
|
0
|
|
|
|
|
|
my $self = { _option => $option }; |
|
31
|
0
|
|
|
|
|
|
bless $self, $class; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
35
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
36
|
0
|
0
|
|
|
|
|
return unless ref $self; |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $option = $self->{_option}; |
|
39
|
0
|
|
|
|
|
|
my $name = $AUTOLOAD; |
|
40
|
0
|
|
|
|
|
|
$name =~ s/.*://; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ( $name =~ /^get_(.+)/ ) { |
|
|
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $enc = uc $1; |
|
44
|
0
|
0
|
|
|
|
|
if ( exists $ENCRYPT_OPT{$enc} ) { |
|
45
|
0
|
0
|
|
|
|
|
return ( $option & $ENCRYPT_OPT{$enc} ? 1 : 0 ); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
else { |
|
48
|
0
|
|
|
|
|
|
return; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
elsif ( $name =~ /^set_(.+)/ ) { |
|
52
|
0
|
|
|
|
|
|
my $enc = uc $1; |
|
53
|
0
|
0
|
|
|
|
|
if ( exists $ENCRYPT_OPT{$enc} ) { |
|
54
|
0
|
|
|
|
|
|
$self->{_option} = $option | $ENCRYPT_OPT{$enc}; |
|
55
|
0
|
|
|
|
|
|
return $self; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
else { |
|
58
|
0
|
|
|
|
|
|
return; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
0
|
|
|
|
|
|
return; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get_option { |
|
67
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
68
|
0
|
|
|
|
|
|
return $self->{_option}; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
|
72
|
|
|
|
|
|
|
__END__ |