line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Rot47; |
2
|
1
|
|
|
1
|
|
25841
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
60
|
|
3
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
51
|
|
4
|
1
|
|
|
1
|
|
9
|
use base 'Exporter'; |
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
4907
|
|
5
|
|
|
|
|
|
|
our @EXPORT_OK = qw(rot47); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.06; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new |
10
|
|
|
|
|
|
|
{ |
11
|
1
|
|
|
1
|
1
|
733
|
my ($class) = @_; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# This object is basically nothing, |
14
|
|
|
|
|
|
|
# and I provide an OOP interface just |
15
|
|
|
|
|
|
|
# to be API-consistent with other |
16
|
|
|
|
|
|
|
# similar Crypt:: modules. |
17
|
1
|
|
|
|
|
4
|
return bless [], $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub encrypt |
21
|
|
|
|
|
|
|
{ |
22
|
2
|
|
|
2
|
1
|
409
|
return rot47($_[1]); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub decrypt |
26
|
|
|
|
|
|
|
{ |
27
|
1
|
|
|
1
|
1
|
456
|
return rot47($_[1]); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub rot47 |
31
|
|
|
|
|
|
|
{ |
32
|
3
|
|
|
3
|
1
|
5
|
my ($text) = @_; |
33
|
3
|
50
|
|
|
|
7
|
return '' if !defined $text; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Rotate every character from decimal 33 '!' |
36
|
|
|
|
|
|
|
# through 126 '~' by 47 positions |
37
|
3
|
|
|
|
|
6
|
$text =~ tr/!-~/P-~!-O/; |
38
|
|
|
|
|
|
|
|
39
|
3
|
|
|
|
|
9
|
return $text; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |