1
mirror of https://github.com/hashcat/hashcat synced 2024-11-20 23:27:31 +01:00

Merge pull request #2498 from philsmd/tests_fix_16400

tests: fixed -m 16400 = CRAM-MD5 Dovecot tests
This commit is contained in:
Jens Steube 2020-07-21 12:48:40 +02:00 committed by GitHub
commit 6a019b9621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -33,6 +33,7 @@
- Backend: Changed the maximum number of compute devices from 64 to 128
- Tests: Improved tests for hash-mode 11300 (Bitcoin/Litecoin wallet.dat)
- Tests: Improved tests for hash-mode 13600 (WinZip)
- Tests: Improved tests for hash-mode 16400 (CRAM-MD5 Dovecot)
- Tests: Improved tests for hash-mode 16800 (WPA-PMKID-PBKDF2)
* changes v5.1.0 -> v6.0.0

View File

@ -14,7 +14,9 @@ sub module_constraints { [[0, 64], [-1, -1], [0, 55], [-1, -1], [-1, -1]] }
sub module_generate_hash
{
my $word = shift;
my $word = shift;
my $salt = shift;
my $end = shift // "0" x 32;
my $md5 = Digest::Perl::MD5->new;
my $length = length ($word);
@ -24,8 +26,8 @@ sub module_generate_hash
$md5->add ();
my $digest = unpack ("H*", pack ('V4', @{$md5->{_state}}));
my $hash = sprintf ("{CRAM-MD5}%s00000000000000000000000000000000", $digest);
my $hash = sprintf ("{CRAM-MD5}%s%s", $digest, $end);
return $hash;
}
@ -43,11 +45,11 @@ sub module_verify_hash
return unless ($signature eq "{CRAM-MD5}");
my $hash = substr ($digest, 10);
my $end = substr ($digest, 42);
my $word_packed = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word_packed);
my $new_hash = module_generate_hash ($word_packed, "", $end);
return ($new_hash, $word);
}