Skip to content
Snippets Groups Projects
Commit 975a466a authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

added simpler hashing algorithm

parent 0de2a772
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ package TA::Hasher;
use Data::Dumper;
$Data::Dumper::Indent= 1;
my %known_algorithms= map { $_ => 1 } qw(NULL S3C2L P3C3L);
my %known_algorithms= map { $_ => 1 } qw(NULL S3C1L S3C2L P3C3L);
sub new
{
......@@ -29,7 +29,12 @@ sub new
$algorithm= $obj->{'algorithm'}= 'NULL';
}
if ($algorithm eq 'S3C2L')
if ($algorithm eq 'S3C1L')
{
print "setting up S3C1L\n";
$obj->{'mkpo'}= \&TA::Hasher::S3C1L::mkpo;
}
elsif ($algorithm eq 'S3C2L')
{
print "setting up S3C2L\n";
$obj->{'mkpo'}= \&TA::Hasher::S3C2L::mkpo;
......@@ -115,6 +120,23 @@ sub mkpo
return { 'L' => [] };
}
package TA::Hasher::S3C1L;
sub mkpo
{
my $S= shift;
return undef unless (defined ($S));
my @L;
if ($S =~ m#(.{1,3})$#)
{ @L= ( $1 ); }
else { @L= ( $S ); }
return { 'L' => \@L };
}
package TA::Hasher::S3C2L;
sub mkpo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment