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

added P4C1L which is more appropriate for hex codes, e.g. md5 or uid

parent 35577cc2
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ package TA::Hasher; ...@@ -9,7 +9,7 @@ package TA::Hasher;
use Data::Dumper; use Data::Dumper;
$Data::Dumper::Indent= 1; $Data::Dumper::Indent= 1;
my %known_algorithms= map { $_ => 1 } qw(NULL S3C1L S3C2L P3C3L P3C2L P3C1L); my %known_algorithms= map { $_ => 1 } qw(NULL S3C1L S3C2L P3C3L P3C2L P3C1L P4C1L);
sub new sub new
{ {
...@@ -51,6 +51,10 @@ sub new ...@@ -51,6 +51,10 @@ sub new
{ {
$obj->{'mkpo'}= \&TA::Hasher::P3C1L::mkpo; $obj->{'mkpo'}= \&TA::Hasher::P3C1L::mkpo;
} }
elsif ($algorithm eq 'P4C1L')
{
$obj->{'mkpo'}= \&TA::Hasher::P4C1L::mkpo;
}
else else
{ {
$obj->{'mkpo'}= \&TA::Hasher::NULL::mkpo; $obj->{'mkpo'}= \&TA::Hasher::NULL::mkpo;
...@@ -217,6 +221,23 @@ sub mkpo ...@@ -217,6 +221,23 @@ sub mkpo
return { 'L' => \@L }; return { 'L' => \@L };
} }
package TA::Hasher::P4C1L;
sub mkpo
{
my $S= shift;
return undef unless (defined ($S));
my @L;
if ($S =~ m#^(.{1,4})#)
{ @L= ( $1 ); }
else { @L= ( $S ); }
return { 'L' => \@L };
}
1; 1;
__END__ __END__
...@@ -227,5 +248,7 @@ __END__ ...@@ -227,5 +248,7 @@ __END__
=item check_path ($mkpo) =item check_path ($mkpo)
=item method to register hasher algorithm
=back =back
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment