line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Imail; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23889
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
691
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
33
|
1
|
0
|
20
|
sub new { bless {}, ref($_[0]) || $_[0] } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub decrypt { |
12
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
13
|
2
|
|
|
|
|
5
|
my ($user, $epass) = @_; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
16
|
my @user = map ord($_), split //, $user; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
11
|
my @key = map $user[0] - $_, @user; |
18
|
2
|
|
|
|
|
77
|
@key = map @key, (0..20); |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
29
|
my @epass = ($epass =~ /(..)/g); |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
7
|
my %data = $self->_data('decrypt'); |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
|
|
36
|
my @pass; |
25
|
|
|
|
|
|
|
{ |
26
|
2
|
|
|
|
|
3
|
my $counter = 0; |
|
2
|
|
|
|
|
4
|
|
27
|
2
|
|
|
|
|
16
|
@pass = map $data{$_} + $key[$counter++], @epass; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
192
|
join '', map chr($_ - ($user[0] - 97)), @pass; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub encrypt { |
34
|
2
|
|
|
2
|
0
|
10
|
my $self = shift; |
35
|
2
|
|
|
|
|
6
|
my ($user, $pass) = @_; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
19
|
my @auser = map ord($_), split //, $user; |
38
|
2
|
|
|
|
|
14
|
my @apass = map ord($_), split //, $pass; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
12
|
my @key = map $auser[0] - $_, @auser; |
41
|
2
|
|
|
|
|
83
|
@key = map @key, (0 .. 12); # hack - be sure it's large enough |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
|
|
12
|
my $offset = $auser[0] - 97; |
44
|
2
|
|
|
|
|
7
|
my @epass = map {($apass[$_] + $offset) - $key[$_]} (0..$#apass); |
|
9
|
|
|
|
|
28
|
|
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
9
|
my %data = $self->_data('encrypt'); |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
273
|
join '', map $data{$_}, @epass; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _data { |
52
|
4
|
|
|
4
|
|
8
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
7
|
my $count = -97; |
55
|
4
|
|
|
|
|
19
|
my @nums = (0..9,'A'..'F'); |
56
|
|
|
|
|
|
|
|
57
|
4
|
|
|
|
|
5
|
my %hash; |
58
|
4
|
|
|
|
|
8
|
for my $base (@nums) { |
59
|
64
|
|
|
|
|
99
|
for (@nums) { |
60
|
1024
|
100
|
|
|
|
1960
|
if ($_[0] eq 'decrypt') { |
|
|
50
|
|
|
|
|
|
61
|
512
|
|
|
|
|
1109
|
$hash{$base.$_} = $count++; |
62
|
|
|
|
|
|
|
}elsif ($_[0] eq 'encrypt') { |
63
|
512
|
|
|
|
|
2107
|
$hash{$count++} = $base.$_; |
64
|
|
|
|
|
|
|
}else{ |
65
|
0
|
|
|
|
|
0
|
warn "pass either encrypt or decrypt to the data function"; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
656
|
%hash; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |