line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# package: Anak Cryptography with Fractal Numerical Algorithm FNA
|
2
|
|
|
|
|
|
|
# author: Mario Rossano aka Anak, www.netlogicalab.com, www.netlogica.it; software@netlogicalab.com; software@netlogica.it
|
3
|
|
|
|
|
|
|
# birthday 05/08/1970; birthplace: Italy
|
4
|
|
|
|
|
|
|
# Validation FILE
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Copyright (C) 2009 Mario Rossano aka Anak
|
7
|
|
|
|
|
|
|
#
|
8
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify it
|
9
|
|
|
|
|
|
|
# under the terms of either:
|
10
|
|
|
|
|
|
|
# CC-NC-BY-SA
|
11
|
|
|
|
|
|
|
# license http://creativecommons.org/licenses/by-nc-sa/2.5/it/deed.en
|
12
|
|
|
|
|
|
|
# Creative Commons License: http://i.creativecommons.org/l/by-nc-sa/2.5/it/88x31.png
|
13
|
|
|
|
|
|
|
# FNA Fractal Numerical Algorithm for a new cryptography technology, author Mario Rossano
|
14
|
|
|
|
|
|
|
# is licensed under a: http://creativecommons.org/B/by-nc-sa/2.5/it/deed.en - Creative Commons Attribution-Noncommercial-Share Alike 2.5 Italy License
|
15
|
|
|
|
|
|
|
# Permissions beyond the scope of this license may be available at software@netlogicalab.com
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package Crypt::FNA::Validation;
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
11
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
20
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1506
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $fna_default_values= (
|
24
|
|
|
|
|
|
|
{
|
25
|
|
|
|
|
|
|
r => 7,
|
26
|
|
|
|
|
|
|
angle => [0,60,-60,0],
|
27
|
|
|
|
|
|
|
square => 4096,
|
28
|
|
|
|
|
|
|
background => [255,255,255],
|
29
|
|
|
|
|
|
|
foreground => [0,0,0],
|
30
|
|
|
|
|
|
|
magic => 3,
|
31
|
|
|
|
|
|
|
zoom => 2,
|
32
|
|
|
|
|
|
|
salted => 'false',
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
);
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new {
|
37
|
0
|
|
|
0
|
1
|
|
my $class = shift;
|
38
|
0
|
|
|
|
|
|
my $init = shift;
|
39
|
0
|
|
|
|
|
|
my $self={};
|
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
bless $self,$class;
|
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$self->intercept($init->{intercept});
|
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $self
|
46
|
|
|
|
|
|
|
}
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub intercept {
|
49
|
0
|
|
|
0
|
1
|
|
my $self=shift;
|
50
|
0
|
0
|
|
|
|
|
if (@_) {
|
51
|
0
|
|
|
|
|
|
$self->{intercept}=shift
|
52
|
|
|
|
|
|
|
}
|
53
|
0
|
|
|
|
|
|
return $self->{intercept}
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub method_new_fna {
|
57
|
0
|
|
|
0
|
1
|
|
my $self=shift;
|
58
|
0
|
|
|
|
|
|
my @error_messages="";
|
59
|
0
|
|
|
|
|
|
@{$self->intercept->{message}}=();
|
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$self->intercept->{r}.="";
|
62
|
0
|
0
|
|
|
|
|
if ($self->intercept->r eq "" | $self->intercept->r eq "0") {
|
63
|
0
|
|
|
|
|
|
$self->intercept->{r}=$fna_default_values->{r}
|
64
|
|
|
|
|
|
|
} else {
|
65
|
0
|
0
|
|
|
|
|
if ($self->intercept->r=~/[^0-9.]/) {
|
66
|
0
|
|
|
|
|
|
push(@error_messages,0);
|
67
|
0
|
|
|
|
|
|
$self->intercept->{r}=$fna_default_values->{r}
|
68
|
|
|
|
|
|
|
}
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
if (!$self->intercept->angle) {
|
72
|
0
|
|
|
|
|
|
@{$self->intercept->{angle}}=@{$fna_default_values->{angle}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} else {
|
74
|
0
|
|
|
|
|
|
for (my $k=0;$kintercept->angle});$k++) {
|
|
0
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if (${$self->intercept->angle}[$k]=~/[^0-9.+-]/) {
|
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
push(@error_messages,5);
|
77
|
0
|
|
|
|
|
|
@{$self->intercept->angle}=@{$fna_default_values->{angle}};
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
last
|
79
|
0
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
}
|
81
|
|
|
|
|
|
|
}
|
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->intercept->{square}.="";
|
84
|
0
|
0
|
|
|
|
|
if ($self->intercept->square eq "" | $self->intercept->square eq "0") {
|
85
|
0
|
|
|
|
|
|
$self->intercept->{square}=$fna_default_values->{square}
|
86
|
|
|
|
|
|
|
} else {
|
87
|
0
|
0
|
|
|
|
|
if ($self->intercept->square=~/[^0-9.]/) {
|
88
|
0
|
|
|
|
|
|
push(@error_messages,2);
|
89
|
0
|
|
|
|
|
|
$self->intercept->{square}=$fna_default_values->{square}
|
90
|
|
|
|
|
|
|
}
|
91
|
|
|
|
|
|
|
}
|
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
if (!$self->intercept->background) {
|
94
|
0
|
|
|
|
|
|
@{$self->intercept->{background}}=@{$fna_default_values->{background}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} else {
|
96
|
0
|
0
|
|
|
|
|
if (scalar(@{$self->intercept->background})>3) {
|
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
push(@error_messages,13);
|
98
|
0
|
|
|
|
|
|
@{$self->intercept->background}=@{$fna_default_values->{background}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} else {
|
100
|
0
|
|
|
|
|
|
for (my $k=0;$kintercept->background});$k++) {
|
|
0
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
if (${$self->intercept->background}[$k]=~/[^0-9]/) {
|
|
0
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
push(@error_messages,12);
|
103
|
0
|
|
|
|
|
|
@{$self->intercept->background}=@{$fna_default_values->{background}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} else {
|
105
|
0
|
0
|
|
|
|
|
if (${$self->intercept->background}[$k]>255) {
|
|
0
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
push(@error_messages,13);
|
107
|
0
|
|
|
|
|
|
@{$self->intercept->background}=@{$fna_default_values->{background}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
}
|
109
|
|
|
|
|
|
|
}
|
110
|
|
|
|
|
|
|
}
|
111
|
|
|
|
|
|
|
}
|
112
|
|
|
|
|
|
|
}
|
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
if (!$self->intercept->foreground) {
|
115
|
0
|
|
|
|
|
|
@{$self->intercept->{foreground}}=@{$fna_default_values->{foreground}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
} else {
|
117
|
0
|
0
|
|
|
|
|
if (scalar(@{$self->intercept->foreground})>3) {
|
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
push(@error_messages,15);
|
119
|
0
|
|
|
|
|
|
@{$self->intercept->foreground}=@{$fna_default_values->{foreground}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
} else {
|
121
|
0
|
|
|
|
|
|
for (my $k=0;$kintercept->foreground});$k++) {
|
|
0
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
if (${$self->intercept->foreground}[$k]=~/[^0-9]/) {
|
|
0
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
push(@error_messages,14);
|
124
|
0
|
|
|
|
|
|
@{$self->intercept->foreground}=@{$fna_default_values->{foreground}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
} else {
|
126
|
0
|
0
|
|
|
|
|
if (${$self->intercept->foreground}[$k]>255) {
|
|
0
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
push(@error_messages,15);
|
128
|
0
|
|
|
|
|
|
@{$self->intercept->foreground}=@{$fna_default_values->{foreground}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
}
|
130
|
|
|
|
|
|
|
}
|
131
|
|
|
|
|
|
|
}
|
132
|
|
|
|
|
|
|
}
|
133
|
|
|
|
|
|
|
}
|
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
$self->intercept->{magic}.="";
|
136
|
0
|
0
|
|
|
|
|
if ($self->intercept->magic eq "") {
|
137
|
0
|
|
|
|
|
|
$self->intercept->{magic}=$fna_default_values->{magic}
|
138
|
|
|
|
|
|
|
} else {
|
139
|
0
|
0
|
|
|
|
|
if (!($self->intercept->magic=~/^[0-9]$/)) {
|
140
|
0
|
|
|
|
|
|
push(@error_messages,20);
|
141
|
0
|
|
|
|
|
|
$self->intercept->{magic}=$fna_default_values->{magic}
|
142
|
|
|
|
|
|
|
}
|
143
|
|
|
|
|
|
|
}
|
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
$self->intercept->{salted}.="";
|
146
|
0
|
0
|
|
|
|
|
if ($self->intercept->salted eq "") {
|
147
|
0
|
|
|
|
|
|
$self->intercept->{salted}=$fna_default_values->{salted}
|
148
|
|
|
|
|
|
|
} else {
|
149
|
0
|
0
|
|
|
|
|
if (!($self->intercept->salted=~/^(true|false)$/i)) {
|
150
|
0
|
|
|
|
|
|
push(@error_messages,21);
|
151
|
0
|
|
|
|
|
|
$self->intercept->{salted}=$fna_default_values->{salted}
|
152
|
|
|
|
|
|
|
}
|
153
|
|
|
|
|
|
|
}
|
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
@{$self->intercept->message}=@error_messages;
|
|
0
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
@error_messages="";
|
157
|
0
|
|
|
|
|
|
return @{$self->intercept->message}
|
|
0
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
}
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub param_zoom_fna {
|
161
|
0
|
|
|
0
|
1
|
|
my $self=shift;
|
162
|
|
|
|
|
|
|
|
163
|
0
|
0
|
|
|
|
|
if (${$self->intercept}[0] =~ /[^0-9.]/) {
|
|
0
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
push(@{$self->intercept->[1]->{message}},18);
|
|
0
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
${$self->intercept}[0]=$fna_default_values->{zoom}
|
|
0
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
}
|
167
|
0
|
|
|
|
|
|
return (${$self->intercept}[0],@{@{$self->intercept}[1]->{message}})
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
}
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub open_file {
|
172
|
0
|
|
|
0
|
1
|
|
my $self=shift;
|
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
push(@{$self->intercept->[1]->{message}},${$self->intercept}[0]);
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
return @{@{$self->intercept}[1]->{message}}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
}
|
177
|
|
|
|
|
|
|
1;
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
# POD SECTION
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 NAME
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Crypt::FNA::Validation
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 VERSION
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Version 0.02
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Crypt::FNA::Validation is a service package for FNA object validation in FNA.pm
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 METHODS
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 new
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Make a 'validation' object (used in fna.pm)
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head2 intercept
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Intercept and validate Crypt::FNA attribute or method
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 method_new_fna
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Validate Crypt::FNA 'new' method
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 open_file
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Validate Crypt::FNA 'open' instruction
|
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head2 param_zoom_fna
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Validate Crypt::FNA param 'zoom' for drawing fractal curve
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 AUTHOR
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Mario Rossano
|
227
|
|
|
|
|
|
|
software@netlogicalab.com
|
228
|
|
|
|
|
|
|
software@netlogica.it
|
229
|
|
|
|
|
|
|
http://www.netlogicalab.com
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head1 BUGS
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Please, send me your alerts to software@netlogica.it
|
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 SUPPORT
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Write me :) software@netlogica.it
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE
|
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
FNA by Mario Rossano, http://www.netlogicalab.com
|
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
This pod text by Mario Rossano
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Copyright (C) 2009 Mario Rossano aka Anak
|
249
|
|
|
|
|
|
|
birthday 05/08/1970; birthplace: Italy
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
252
|
|
|
|
|
|
|
under the terms of either:
|
253
|
|
|
|
|
|
|
CC-NC-BY-SA
|
254
|
|
|
|
|
|
|
license http://creativecommons.org/licenses/by-nc-sa/2.5/it/deed.en
|
255
|
|
|
|
|
|
|
Creative Commons License: http://i.creativecommons.org/l/by-nc-sa/2.5/it/88x31.png
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
FNA Fractal Numerical Algorithm for a new cryptography technology, author Mario Rossano
|
258
|
|
|
|
|
|
|
is licensed under a: http://creativecommons.org/B/by-nc-sa/2.5/it/deed.en - Creative Commons Attribution-Noncommercial-Share Alike 2.5 Italy License
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Permissions beyond the scope of this license may be available at software@netlogicalab.com
|