| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
86745
|
use 5.008; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Crypt::Polybius::Greek; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
8
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
912
|
use Moo; |
|
|
1
|
|
|
|
|
13687
|
|
|
|
1
|
|
|
|
|
7
|
|
|
11
|
1
|
|
|
1
|
|
3074
|
use Text::Unidecode; |
|
|
1
|
|
|
|
|
2000
|
|
|
|
1
|
|
|
|
|
64
|
|
|
12
|
1
|
|
|
1
|
|
834
|
use namespace::sweep; |
|
|
1
|
|
|
|
|
19861
|
|
|
|
1
|
|
|
|
|
6
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with qw( |
|
15
|
|
|
|
|
|
|
MooX::Traits |
|
16
|
|
|
|
|
|
|
Crypt::Role::CheckerboardCipher |
|
17
|
|
|
|
|
|
|
Crypt::Role::GreekAlphabet |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=pod |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=encoding utf-8 |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Crypt::Polybius::Greek - implementation of the Polybius square using the Greek alphabet |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use utf8; |
|
35
|
|
|
|
|
|
|
use Crypt::Polybius; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# 1 2 3 4 5 |
|
38
|
|
|
|
|
|
|
# 1 Î Î Î Î Î |
|
39
|
|
|
|
|
|
|
# 2 Î Î Î Î Î |
|
40
|
|
|
|
|
|
|
# 3 Î Î Î Î Î |
|
41
|
|
|
|
|
|
|
# 4 ΠΡ Σ Τ Υ |
|
42
|
|
|
|
|
|
|
# 5 Φ Χ Ψ Ω |
|
43
|
|
|
|
|
|
|
# |
|
44
|
|
|
|
|
|
|
# ÎλÏα -> 11 31 51 11 |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $square = Crypt::Polybius::Greek->new; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
print $square->encipher("ÎλÏα"), "\n"; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This module provides an object-oriented implementation of the |
|
53
|
|
|
|
|
|
|
B<Polybius square>, or B<Polybius checkerboard> using the |
|
54
|
|
|
|
|
|
|
Greek alphabet. This cipher is not cryptographically strong, |
|
55
|
|
|
|
|
|
|
nor completely round-trip-safe. And it requires you to write in |
|
56
|
|
|
|
|
|
|
Greek. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 Roles |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This class performs the following roles: |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
L<Crypt::Role::GreekAlphabet> |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher> |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L<MooX::Traits> |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 Constructors |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item C<< new(%attributes) >> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Moose-like constructor. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item C<< new_with_traits(%attributes, traits => \@traits) >> |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Alternative constructor provided by L<MooX::Traits>. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 Attributes |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The following attributes exist. All of them have defaults, and should |
|
95
|
|
|
|
|
|
|
not be provided to the constructor. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item C<< square >> |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
An array of arrays of letters. Provided by |
|
102
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher>. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item C<< square_size >> |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
The length of one side of the square, as an integer. Provided by |
|
107
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher>. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item C<< encipher_hash >> |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Hashref used by the C<encipher> method. Provided by |
|
112
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher>. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item C<< decipher_hash >> |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Hashref used by the C<decipher> method. Provided by |
|
117
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher>. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 Object Methods |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item C<< encipher($str) >> |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Enciphers a string and returns the ciphertext. Provided by |
|
128
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher>. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item C<< decipher($str) >> |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Deciphers a string and returns the plaintext. Provided by |
|
133
|
|
|
|
|
|
|
L<Crypt::Role::CheckerboardCipher>. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item C<< preprocess($str) >> |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Perform pre-encipher processing on a string. C<encipher> calls this, so |
|
138
|
|
|
|
|
|
|
you are unlikely to need to call it yourself. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The implementation provided by L<Crypt::Role::GreekAlphabet> uppercases |
|
141
|
|
|
|
|
|
|
any lower-case letters, and handles most common Greek diacritics. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item C<< alphabet >> |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Returns an arrayref of the known alphabet. Provided by |
|
146
|
|
|
|
|
|
|
L<Crypt::Role::GreekAlphabet>. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 Class Method |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=over |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item C<< with_traits(@traits) >> |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Generates a new class based on this class, but adding traits. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<Crypt::Role::ScrambledAlphabet> is an example of an interesting |
|
159
|
|
|
|
|
|
|
trait that works with this class. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 BUGS |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Please report any bugs to |
|
166
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Crypt-Polybius>. |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L<http://en.wikipedia.org/wiki/Polybius_square>. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
L<Crypt::Polybius>. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Toby Inkster. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
183
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
|
188
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
|
189
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|
190
|
|
|
|
|
|
|
|