1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Fix password length for optimized mode in constraints for hash-mode 22: 55 - (1 + 20 + 1)

This commit is contained in:
jsteube 2019-01-03 11:03:35 +01:00
parent 3516fd70a4
commit 9ee247c6f8

View File

@ -10,17 +10,14 @@ use warnings;
use Digest::MD5 qw (md5); use Digest::MD5 qw (md5);
sub module_constraints { [[0, 256], [1, 11], [0, 35], [1, 11], [1, 35]] } sub module_constraints { [[0, 255], [1, 11], [0, 33], [1, 11], [1, 33]] }
sub module_generate_hash sub module_generate_hash
{ {
my $itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
my $salt_suffix = "Administration Tools";
my $word = shift; my $word = shift;
my $salt = shift; my $salt = shift;
my $pass = sprintf ("%s:%s:%s", $salt, $salt_suffix, $word); my $pass = sprintf ("%s:Administration Tools:%s", $salt, $word);
my $hash_buf = md5 ($pass); my $hash_buf = md5 ($pass);
@ -31,12 +28,15 @@ sub module_generate_hash
my $octet1 = ord (substr ($hash_buf, $pos + 0, 1)); my $octet1 = ord (substr ($hash_buf, $pos + 0, 1));
my $octet2 = ord (substr ($hash_buf, $pos + 1, 1)); my $octet2 = ord (substr ($hash_buf, $pos + 1, 1));
my $num = ($octet1 <<8 & 0xff00) | ($octet2 & 0xff); my $num = (($octet1 << 8) & 0xff00)
| (($octet2 << 0) & 0x00ff);
my $idx1 = $num >> 12 & 0x0f; my $idx1 = $num >> 12 & 0x0f;
my $idx2 = $num >> 6 & 0x3f; my $idx2 = $num >> 6 & 0x3f;
my $idx3 = $num & 0x3f; my $idx3 = $num & 0x3f;
my $itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
$res = $res . substr ($itoa64, $idx1, 1) . substr ($itoa64, $idx2, 1) . substr ($itoa64, $idx3, 1); $res = $res . substr ($itoa64, $idx1, 1) . substr ($itoa64, $idx2, 1) . substr ($itoa64, $idx3, 1);
} }
@ -46,6 +46,7 @@ sub module_generate_hash
foreach my $pos (keys @obfuscate_pos) foreach my $pos (keys @obfuscate_pos)
{ {
my $idx = $obfuscate_pos[$pos]; my $idx = $obfuscate_pos[$pos];
my $before = substr ($res, 0, $idx); my $before = substr ($res, 0, $idx);
my $char = substr ($obfuscate_str, $pos, 1); my $char = substr ($obfuscate_str, $pos, 1);
my $after = substr ($res, $idx); my $after = substr ($res, $idx);