mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
More coding style fixes
This commit is contained in:
parent
ac2b811941
commit
3869ce9246
@ -67,7 +67,7 @@ __kernel void m18100_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
// grab 4 consecutive bytes of the hash, starting at offset
|
||||
// on some systems, &3 is faster than %4, so we will use it in our switch()
|
||||
switch(otp_offset & 3)
|
||||
switch (otp_offset & 3)
|
||||
{
|
||||
case 1:
|
||||
otp_code = ((ctx.opad.h[otp_offset/4] & 0x00ffffff) << 8) | ((ctx.opad.h[otp_offset/4+1] & 0xff000000) >> 24);
|
||||
@ -160,7 +160,7 @@ __kernel void m18100_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
// grab 4 consecutive bytes of the hash, starting at offset
|
||||
// on some systems, &3 is faster than %4, so we will use it in our switch()
|
||||
switch(otp_offset & 3)
|
||||
switch (otp_offset & 3)
|
||||
{
|
||||
case 1:
|
||||
otp_code = ((ctx.opad.h[otp_offset/4] & 0x00ffffff) << 8) | ((ctx.opad.h[otp_offset/4+1] & 0xff000000) >> 24);
|
||||
|
@ -90,7 +90,7 @@ __kernel void m18100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
// grab 4 consecutive bytes of the hash, starting at offset
|
||||
// on some systems, &3 is faster than %4, so we will use it in our switch()
|
||||
switch(otp_offset & 3)
|
||||
switch (otp_offset & 3)
|
||||
{
|
||||
case 1:
|
||||
otp_code = ((ctx.opad.h[otp_offset/4] & 0x00ffffff) << 8) | ((ctx.opad.h[otp_offset/4+1] & 0xff000000) >> 24);
|
||||
@ -208,7 +208,7 @@ __kernel void m18100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
// grab 4 consecutive bytes of the hash, starting at offset
|
||||
// on some systems, &3 is faster than %4, so we will use it in our switch()
|
||||
switch(otp_offset & 3)
|
||||
switch (otp_offset & 3)
|
||||
{
|
||||
case 1:
|
||||
otp_code = ((ctx.opad.h[otp_offset/4] & 0x00ffffff) << 8) | ((ctx.opad.h[otp_offset/4+1] & 0xff000000) >> 24);
|
||||
|
@ -76,7 +76,7 @@ __kernel void m18100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
// grab 4 consecutive bytes of the hash, starting at offset
|
||||
// on some systems, &3 is faster than %4, so we will use it in our switch()
|
||||
switch(otp_offset & 3)
|
||||
switch (otp_offset & 3)
|
||||
{
|
||||
case 1:
|
||||
otp_code = ((ctx.opad.h[otp_offset/4] & 0x00ffffff) << 8) | ((ctx.opad.h[otp_offset/4+1] & 0xff000000) >> 24);
|
||||
@ -180,9 +180,9 @@ __kernel void m18100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
// grab 4 consecutive bytes of the hash, starting at offset
|
||||
// on some systems, &3 is faster than %4, so we will use it in our switch()
|
||||
switch(otp_offset & 3)
|
||||
switch (otp_offset & 3)
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
otp_code = ((ctx.opad.h[otp_offset/4] & 0x00ffffff) << 8) | ((ctx.opad.h[otp_offset/4+1] & 0xff000000) >> 24);
|
||||
break;
|
||||
case 2:
|
||||
|
@ -5184,17 +5184,14 @@ int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
|
||||
token.len_min[1] *= 2;
|
||||
token.len_max[1] *= 2;
|
||||
|
||||
token.attr[1] |= TOKEN_ATTR_VERIFY_HEX;
|
||||
token.attr[1] |= TOKEN_ATTR_VERIFY_DIGIT;
|
||||
}
|
||||
|
||||
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token);
|
||||
|
||||
// now we need to reduce our hash into a token
|
||||
int otp_code = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
otp_code = otp_code * 10 + itoa32_to_int (input_buf[i]);
|
||||
}
|
||||
int otp_code = hc_strtoul ((const char *) input_buf, NULL, 10);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
digest[1] = otp_code;
|
||||
@ -5202,15 +5199,14 @@ int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
|
||||
u8 *salt_pos = token.buf[1];
|
||||
|
||||
// convert ascii timestamp to ulong timestamp
|
||||
unsigned long timestamp = 0;
|
||||
timestamp = hc_strtoul ((const char *) salt_pos, NULL, 10);
|
||||
u64 timestamp = hc_strtoul ((const char *) salt_pos, NULL, 10);
|
||||
|
||||
// divide our timestamp by our step. We will use the RFC 6238 default of 30 for now
|
||||
timestamp /= 30;
|
||||
|
||||
// convert counter to 8-byte salt
|
||||
salt->salt_buf[1] = byte_swap_32 (timestamp);
|
||||
salt->salt_buf[0] = byte_swap_32 (timestamp >> 32);
|
||||
salt->salt_buf[1] = byte_swap_32 ((u32) (timestamp >> 0));
|
||||
salt->salt_buf[0] = byte_swap_32 ((u32) (timestamp >> 32));
|
||||
|
||||
// our salt will always be 8 bytes
|
||||
salt->salt_len = 8;
|
||||
|
Loading…
Reference in New Issue
Block a user