tests: fixed -m 16400 = CRAM-MD5 Dovecot tests

pull/2498/head
philsmd 4 years ago
parent c518240b67
commit 6b395b67c2
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF

@ -32,6 +32,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

@ -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);
}

Loading…
Cancel
Save