mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
fixed kernel, added test module
This commit is contained in:
parent
2097d67cd5
commit
ba82dd235c
@ -422,29 +422,15 @@ KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m03201_init (KERN_ATTR_TMPS
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 w[18];
|
||||
|
||||
w[ 0] = pws[gid].i[ 0];
|
||||
w[ 1] = pws[gid].i[ 1];
|
||||
w[ 2] = pws[gid].i[ 2];
|
||||
w[ 3] = pws[gid].i[ 3];
|
||||
w[ 4] = pws[gid].i[ 4];
|
||||
w[ 5] = pws[gid].i[ 5];
|
||||
w[ 6] = pws[gid].i[ 6];
|
||||
w[ 7] = pws[gid].i[ 7];
|
||||
w[ 8] = pws[gid].i[ 8];
|
||||
w[ 9] = pws[gid].i[ 9];
|
||||
w[10] = pws[gid].i[10];
|
||||
w[11] = pws[gid].i[11];
|
||||
w[12] = pws[gid].i[12];
|
||||
w[13] = pws[gid].i[13];
|
||||
w[14] = pws[gid].i[14];
|
||||
w[15] = pws[gid].i[15];
|
||||
w[16] = pws[gid].i[16];
|
||||
w[17] = pws[gid].i[17];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
md5_ctx_t ctx0;
|
||||
|
||||
md5_init (&ctx0);
|
||||
|
74
tools/test_modules/m03201.pm
Normal file
74
tools/test_modules/m03201.pm
Normal file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64);
|
||||
use MIME::Base64 qw (decode_base64);
|
||||
|
||||
sub module_constraints { [[0, 72], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift;
|
||||
my $iter = shift;
|
||||
|
||||
my $cost = "05";
|
||||
|
||||
if (length ($iter))
|
||||
{
|
||||
$cost = $iter;
|
||||
}
|
||||
|
||||
my $hash = bcrypt ($word, sprintf ('$2a$%s$%s$', $cost, en_base64 ($salt)));
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
my $index1 = index ($line, ":", 33);
|
||||
|
||||
return if $index1 < 1;
|
||||
|
||||
my $hash = substr ($line, 0, $index1);
|
||||
my $word = substr ($line, $index1 + 1);
|
||||
|
||||
my $index2 = index ($hash, "\$", 4);
|
||||
|
||||
my $iter = substr ($hash, 4, $index2 - 4);
|
||||
|
||||
my $plain_base64 = substr ($hash, $index2 + 1, 22);
|
||||
|
||||
# base64 mapping
|
||||
|
||||
my $base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
my $itoa64_2 = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
my $encoded = "";
|
||||
|
||||
for (my $i = 0; $i < length ($plain_base64); $i++)
|
||||
{
|
||||
my $char = substr ($plain_base64, $i, 1);
|
||||
|
||||
$encoded .= substr ($base64, index ($itoa64_2, $char), 1);
|
||||
}
|
||||
|
||||
my $salt = decode_base64 ($encoded);
|
||||
|
||||
my $word_packed = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word_packed, $salt, $iter);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user