1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00

Enhanced test.pl for 15400 and removed endianess confusion

This commit is contained in:
DoZ10 2017-05-15 19:21:49 -04:00
parent 6af53218d4
commit 264ec951c2
2 changed files with 15 additions and 12 deletions

View File

@ -5347,11 +5347,11 @@ int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8); chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8);
chacha20->iv[1] = hex_to_u32 ((const u8 *) iv_marker + 0); chacha20->iv[1] = hex_to_u32 ((const u8 *) iv_marker + 0);
chacha20->plain[0] = hex_to_u32 ((const u8 *) plain_marker + 8); chacha20->plain[0] = hex_to_u32 ((const u8 *) plain_marker + 0);
chacha20->plain[1] = hex_to_u32 ((const u8 *) plain_marker + 0); chacha20->plain[1] = hex_to_u32 ((const u8 *) plain_marker + 8);
chacha20->position[0] = byte_swap_32(hex_to_u32 ((const u8 *) position_marker + 8)); chacha20->position[0] = hex_to_u32 ((const u8 *) position_marker + 0);
chacha20->position[1] = byte_swap_32(hex_to_u32 ((const u8 *) position_marker + 0)); chacha20->position[1] = hex_to_u32 ((const u8 *) position_marker + 8);
chacha20->offset = offset; chacha20->offset = offset;
@ -18566,13 +18566,13 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
snprintf (out_buf, out_len - 1, "%s*%08x%08x*%d*%08x%08x*%08x%08x*%08x%08x", snprintf (out_buf, out_len - 1, "%s*%08x%08x*%d*%08x%08x*%08x%08x*%08x%08x",
SIGNATURE_CHACHA20, SIGNATURE_CHACHA20,
chacha20->position[1], byte_swap_32(chacha20->position[0]),
chacha20->position[0], byte_swap_32(chacha20->position[1]),
chacha20->offset, chacha20->offset,
byte_swap_32(chacha20->iv[1]), byte_swap_32(chacha20->iv[1]),
byte_swap_32(chacha20->iv[0]), byte_swap_32(chacha20->iv[0]),
byte_swap_32(chacha20->plain[1]),
byte_swap_32(chacha20->plain[0]), byte_swap_32(chacha20->plain[0]),
byte_swap_32(chacha20->plain[1]),
ptr[1], ptr[1],
ptr[0]); ptr[0]);
} }

View File

@ -8156,8 +8156,11 @@ END_CODE
} }
elsif ($mode == 15400) elsif ($mode == 15400)
{ {
my $eight_byte_iv = pack("H*", "0000000000000000"); my $iv = "0200000000000001";
my $eight_byte_counter = pack("H*", "0100000000000000"); # little endian 64 bits my $counter = "0400000000000003";
my $plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0a2b4c6d8e";
my $eight_byte_iv = pack("H*", $iv);
my $eight_byte_counter = pack("H*", $counter);
my $offset = int(rand(63)); my $offset = int(rand(63));
my $pad_len = 32 - length $word_buf; my $pad_len = 32 - length $word_buf;
my $key = $word_buf . "\0" x $pad_len; my $key = $word_buf . "\0" x $pad_len;
@ -8165,11 +8168,11 @@ END_CODE
$cipher->ivsetup($eight_byte_iv, $eight_byte_counter); $cipher->ivsetup($eight_byte_iv, $eight_byte_counter);
my $enc = $cipher->encrypt("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); my $enc = $cipher->encrypt($plaintext);
my $enc_offset = substr($enc, $offset, 8); my $enc_offset = substr($enc, $offset, 8);
$hash_buf = $enc_offset; $hash_buf = $enc_offset;
$tmp_hash = sprintf ("\$Chacha20\$\*%08x%08x\*%d\*0000000000000000\*4141414141414141\*%s", (unpack("V*", $eight_byte_counter))[1], (unpack("V*", $eight_byte_counter))[0], $offset, unpack("H*", $enc_offset)); $tmp_hash = sprintf ("\$Chacha20\$\*%s\*%d\*%s\*%s\*%s", $counter, $offset, $iv, unpack("H*", substr($plaintext, $offset, 8)), unpack("H*", $enc_offset));
} }
elsif ($mode == 99999) elsif ($mode == 99999)
{ {