From 64278babc043b8c30af8d2c1d601c47e807c27a8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 29 Jul 2025 08:21:39 -0700 Subject: [PATCH] Fixed a1 kernel error, Added perl test-unit. All unit tests passed. --- OpenCL/m22800_a1-pure.cl | 16 +++++++++---- tools/test_modules/m22800.pm | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 tools/test_modules/m22800.pm diff --git a/OpenCL/m22800_a1-pure.cl b/OpenCL/m22800_a1-pure.cl index f85b200ea..f7895e414 100644 --- a/OpenCL/m22800_a1-pure.cl +++ b/OpenCL/m22800_a1-pure.cl @@ -97,9 +97,12 @@ KERNEL_FQ void m22800_mxx (KERN_ATTR_BASIC ()) // Update with salt md5_update (&ctx, s, salt_len); - // Update with the password combination - md5_update (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len); + // Update with the password combination using global functions + md5_update_global (&ctx, pws[gid].i, pws[gid].pw_len); + md5_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len); + + // Update with the hexadecimal MD5 result u32 w0[4]; u32 w1[4]; u32 w2[4]; @@ -224,11 +227,14 @@ KERNEL_FQ void m22800_sxx (KERN_ATTR_BASIC ()) md5_init (&ctx); - // Update with salt + // Update with salt md5_update (&ctx, s, salt_len); - // Update with the password combination - md5_update (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len); + // Update with the password combination + md5_update_global (&ctx, pws[gid].i, pws[gid].pw_len); + md5_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len); + + // Update with the hexadecimal MD5 result u32 w0[4]; u32 w1[4]; u32 w2[4]; diff --git a/tools/test_modules/m22800.pm b/tools/test_modules/m22800.pm new file mode 100644 index 000000000..f87d30934 --- /dev/null +++ b/tools/test_modules/m22800.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 256], [0, 223], [0, 55], [0, 23], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . $word . md5_hex ($word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1;