mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-29 11:28:15 +00:00
Convert sha1b64_parse_hash() to make use of input_tokenizer()
This commit is contained in:
parent
d36e70b598
commit
5728933cd2
@ -1295,8 +1295,6 @@ typedef enum display_len
|
||||
DISPLAY_LEN_MAX_12 = 32 + 1 + 32,
|
||||
DISPLAY_LEN_MIN_23 = 32 + 1 + 0,
|
||||
DISPLAY_LEN_MAX_23 = 32 + 1 + SALT_MAX,
|
||||
DISPLAY_LEN_MIN_101 = 5 + 28,
|
||||
DISPLAY_LEN_MAX_101 = 5 + 28,
|
||||
DISPLAY_LEN_MIN_111 = 6 + 28 + 1,
|
||||
DISPLAY_LEN_MAX_111 = 6 + 28 + SALT_MAX,
|
||||
DISPLAY_LEN_MIN_112 = 40 + 1 + 20,
|
||||
|
@ -5348,15 +5348,32 @@ int pstoken_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
|
||||
|
||||
int sha1b64_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig)
|
||||
{
|
||||
if ((input_len < DISPLAY_LEN_MIN_101) || (input_len > DISPLAY_LEN_MAX_101)) return (PARSER_GLOBAL_LENGTH);
|
||||
|
||||
if (memcmp (SIGNATURE_SHA1B64, input_buf, 5) != 0) return (PARSER_SIGNATURE_UNMATCHED);
|
||||
|
||||
u32 *digest = (u32 *) hash_buf->digest;
|
||||
|
||||
token_t token;
|
||||
|
||||
token.token_cnt = 2;
|
||||
token.signature = SIGNATURE_SHA1B64;
|
||||
|
||||
token.len[0] = 5;
|
||||
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_SIGNATURE;
|
||||
|
||||
token.len_min[1] = 28;
|
||||
token.len_max[1] = 28;
|
||||
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_BASE64A;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
u8 *hash_pos = token.buf[1];
|
||||
int hash_len = token.len[1];
|
||||
|
||||
u8 tmp_buf[100] = { 0 };
|
||||
|
||||
base64_decode (base64_to_int, (const u8 *) input_buf + 5, input_len - 5, tmp_buf);
|
||||
base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf);
|
||||
|
||||
memcpy (digest, tmp_buf, 20);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user