mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Rename -m 25850 to 30600 and add missing unit-test
This commit is contained in:
parent
6e0ec16e35
commit
80ba8ca18e
@ -444,7 +444,7 @@ DECLSPEC u32 u16_bin_to_u32_hex (const u32 v)
|
||||
| ((v1 < 10) ? '0' + v1 : 'a' - 10 + v1) << 0;
|
||||
}
|
||||
|
||||
KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m25850_init (KERN_ATTR_TMPS (bcrypt_tmp_t))
|
||||
KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m30600_init (KERN_ATTR_TMPS (bcrypt_tmp_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -695,7 +695,7 @@ KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m25850_init (KERN_ATTR_TMPS
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m25850_loop (KERN_ATTR_TMPS (bcrypt_tmp_t))
|
||||
KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m30600_loop (KERN_ATTR_TMPS (bcrypt_tmp_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -898,7 +898,7 @@ KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m25850_loop (KERN_ATTR_TMPS
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m25850_comp (KERN_ATTR_TMPS (bcrypt_tmp_t))
|
||||
KERNEL_FQ void FIXED_THREAD_COUNT(FIXED_LOCAL_SIZE) m30600_comp (KERN_ATTR_TMPS (bcrypt_tmp_t))
|
||||
{
|
||||
/**
|
||||
* base
|
@ -15,8 +15,8 @@
|
||||
- Added hash-mode: GPG (AES-128/AES-256 (SHA-512($pass)))
|
||||
- Added hash-mode: HMAC-RIPEMD160 (key = $pass)
|
||||
- Added hash-mode: HMAC-RIPEMD160 (key = $salt)
|
||||
- Added hash-mode: md5(md5($salt).md5(md5($pass)))
|
||||
- Added hash-mode: bcrypt(sha256($pass))
|
||||
- Added hash-mode: md5(md5($salt).md5(md5($pass)))
|
||||
|
||||
##
|
||||
## Bugs
|
||||
|
@ -18,7 +18,7 @@ static const u32 DGST_POS3 = 3;
|
||||
static const u32 DGST_SIZE = DGST_SIZE_4_6;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE;
|
||||
static const char *HASH_NAME = "bcrypt(sha256($pass)) / bcryptsha256";
|
||||
static const u64 KERN_TYPE = 25850;
|
||||
static const u64 KERN_TYPE = 30600;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE
|
||||
| OPTS_TYPE_PT_GENERATE_LE
|
84
tools/test_modules/m30600.pm
Normal file
84
tools/test_modules/m30600.pm
Normal file
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Crypt::Eksblowfish::Bcrypt qw (bcrypt bcrypt_hash en_base64);
|
||||
use MIME::Base64 qw (decode_base64);
|
||||
use Digest::SHA qw (sha256_hex);
|
||||
|
||||
sub module_constraints { [[0, 256], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift;
|
||||
my $iter = shift;
|
||||
|
||||
my $cost = "10";
|
||||
|
||||
if (length ($iter))
|
||||
{
|
||||
$cost = $iter;
|
||||
}
|
||||
|
||||
my $sha256_word = sha256_hex ($word);
|
||||
|
||||
my $attrs =
|
||||
{
|
||||
key_nul => 1,
|
||||
cost => $cost,
|
||||
salt => $salt,
|
||||
};
|
||||
|
||||
my $hash = bcrypt_hash ($attrs, $sha256_word);
|
||||
|
||||
return sprintf ('$2b$%s$%s%s', $cost, en_base64 ($salt), en_base64 ($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