From 799bc0abe4cd6ab1231a6b419d30cbfefc5876e8 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Wed, 15 Sep 2021 14:20:15 +0200 Subject: [PATCH] Prepare IV support in unit test for -m 11500 --- tools/test_modules/m11500.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/test_modules/m11500.pm b/tools/test_modules/m11500.pm index ac1bb07ec..b18afd5f9 100644 --- a/tools/test_modules/m11500.pm +++ b/tools/test_modules/m11500.pm @@ -8,17 +8,31 @@ use strict; use warnings; -use Digest::CRC qw (crc32); +use Digest::CRC; sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [8, 8], [-1, -1]] } sub module_generate_hash { my $word = shift; + my $salt = shift; - my $digest = crc32 ($word); + $salt = "00000000"; - my $hash = sprintf ("%08x:00000000", $digest); + my $ctx = Digest::CRC->new + ( + width => 32, + init => hex ($salt), + xorout => 0xffffffff, + refout => 1, + poly => 0x04c11db7, + refin => 1, + cont => 1 + ); + + $ctx->add ($word); + + my $hash = sprintf ("%s:%s", $ctx->hexdigest (), $salt); return $hash; }