From c0e83dc471dec905102d32d3bdea5605501fdf8b Mon Sep 17 00:00:00 2001 From: jsteube Date: Fri, 21 Dec 2018 09:10:23 +0100 Subject: [PATCH] Some minor test.pl fixes, added m01000.pm --- tools/install_modules.sh | 1 + tools/test.pl | 4 ++- tools/test_modules/{m0.pm => m00000.pm} | 1 + tools/test_modules/{m100.pm => m00100.pm} | 1 + tools/test_modules/{m110.pm => m00110.pm} | 1 + tools/test_modules/{m120.pm => m00120.pm} | 1 + tools/test_modules/m01000.pm | 41 +++++++++++++++++++++++ tools/test_modules/m18400.pm | 1 + tools/test_modules/m18600.pm | 1 + 9 files changed, 51 insertions(+), 1 deletion(-) rename tools/test_modules/{m0.pm => m00000.pm} (97%) rename tools/test_modules/{m100.pm => m00100.pm} (97%) rename tools/test_modules/{m110.pm => m00110.pm} (97%) rename tools/test_modules/{m120.pm => m00120.pm} (97%) create mode 100644 tools/test_modules/m01000.pm diff --git a/tools/install_modules.sh b/tools/install_modules.sh index 2e2f8b0dd..0f12d9d28 100755 --- a/tools/install_modules.sh +++ b/tools/install_modules.sh @@ -32,6 +32,7 @@ cpan install Authen::Passphrase::LANManager \ Crypt::Skip32 \ Crypt::Twofish \ Crypt::UnixCrypt_XS \ + Data::Types \ Digest::BLAKE2 \ Digest::CMAC \ Digest::CRC \ diff --git a/tools/test.pl b/tools/test.pl index 548dde66e..524052872 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -24,7 +24,9 @@ is_in_array ($TYPE, $TYPES) or usage_exit (); is_whole ($MODE) or die "Mode must be a number\n"; -eval { require "m$MODE.pm" } or die "Could not load test module:\n$@"; +my $module = sprintf ("m%05d.pm", $MODE); + +eval { require $module; } or die "Could not load test module: $module\n$@"; if ($TYPE eq 'single') { diff --git a/tools/test_modules/m0.pm b/tools/test_modules/m00000.pm similarity index 97% rename from tools/test_modules/m0.pm rename to tools/test_modules/m00000.pm index da25bf5c1..3016c4a96 100644 --- a/tools/test_modules/m0.pm +++ b/tools/test_modules/m00000.pm @@ -6,6 +6,7 @@ ## use strict; +use warnings; use Digest::MD5 qw (md5_hex); diff --git a/tools/test_modules/m100.pm b/tools/test_modules/m00100.pm similarity index 97% rename from tools/test_modules/m100.pm rename to tools/test_modules/m00100.pm index 7f87d334f..cfa422e91 100644 --- a/tools/test_modules/m100.pm +++ b/tools/test_modules/m00100.pm @@ -6,6 +6,7 @@ ## use strict; +use warnings; use Digest::SHA qw (sha1_hex); diff --git a/tools/test_modules/m110.pm b/tools/test_modules/m00110.pm similarity index 97% rename from tools/test_modules/m110.pm rename to tools/test_modules/m00110.pm index a4883124c..5c8e8f9c4 100644 --- a/tools/test_modules/m110.pm +++ b/tools/test_modules/m00110.pm @@ -6,6 +6,7 @@ ## use strict; +use warnings; use Digest::SHA qw (sha1_hex); diff --git a/tools/test_modules/m120.pm b/tools/test_modules/m00120.pm similarity index 97% rename from tools/test_modules/m120.pm rename to tools/test_modules/m00120.pm index 765f959e6..71325a2d4 100644 --- a/tools/test_modules/m120.pm +++ b/tools/test_modules/m00120.pm @@ -6,6 +6,7 @@ ## use strict; +use warnings; use Digest::SHA qw (sha1_hex); diff --git a/tools/test_modules/m01000.pm b/tools/test_modules/m01000.pm new file mode 100644 index 000000000..be27b5d62 --- /dev/null +++ b/tools/test_modules/m01000.pm @@ -0,0 +1,41 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD4 qw (md4_hex); +use Encode; + +sub module_generate_hash +{ + my $word = shift; + + my $hash = md4_hex (encode ("UTF-16LE", $word)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split ":", $line; + + return unless defined $hash; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word); + + return unless $new_hash eq $hash; + + return $new_hash; +} + +1; diff --git a/tools/test_modules/m18400.pm b/tools/test_modules/m18400.pm index 0c7ed42c8..182e5bb61 100644 --- a/tools/test_modules/m18400.pm +++ b/tools/test_modules/m18400.pm @@ -6,6 +6,7 @@ ## use strict; +use warnings; use Crypt::Mode::CBC; use Crypt::PBKDF2; diff --git a/tools/test_modules/m18600.pm b/tools/test_modules/m18600.pm index e18fb2bd5..68155ad96 100644 --- a/tools/test_modules/m18600.pm +++ b/tools/test_modules/m18600.pm @@ -6,6 +6,7 @@ ## use strict; +use warnings; use Crypt::GCrypt; use Crypt::PBKDF2;