1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-25 16:08:39 +00:00

PR comments polish 1

This commit is contained in:
Dylan Evans 2024-06-07 11:43:00 -04:00
parent ad03dcaffa
commit d0dc41f98d
4 changed files with 16 additions and 54 deletions

1
.gitignore vendored
View File

@ -24,4 +24,3 @@ obj/*.o
obj/*.a
include/CL
tools/luks_tests
.vscode/

View File

@ -1,5 +1,7 @@
// m12150-pure.cl
//#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
@ -39,28 +41,16 @@ KERNEL_FQ void m12150_init (KERN_ATTR_TMPS_ESALT (shiro1_sha512_tmp_t, shiro1_sh
sha512_init (&ctx);
/*printf("Salt length: %d\n", salt_bufs[SALT_POS_HOST].salt_len);
printf("Iterations: %d\n", esalt_bufs[DIGESTS_OFFSET_HOST].iterations);
printf("Password: %s length: %d\n", pws[gid].i, pws[gid].pw_len);
printf("Salt: ");
for (int i = 0; i < 4; i++) {
printf("%08x", esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf[i]);
}
printf("\n");*/
sha512_update_global_swap (&ctx, salt_bufs[SALT_POS_HOST].salt_buf, salt_bufs[SALT_POS_HOST].salt_len);
sha512_update_global_swap (&ctx, pws[gid].i, pws[gid].pw_len);
sha512_final (&ctx);
//printf("Initial hash: ");
for (int i = 0; i < 8; i++) {
tmps[gid].dgst[i] = ctx.h[i];
tmps[gid].out[i] = ctx.h[i];
//printf("%016llx", ctx.h[i]);
}
//printf("\n");
}
KERNEL_FQ void m12150_loop(KERN_ATTR_TMPS_ESALT(shiro1_sha512_tmp_t, shiro1_sha512_t)) {
@ -92,9 +82,9 @@ KERNEL_FQ void m12150_loop(KERN_ATTR_TMPS_ESALT(shiro1_sha512_tmp_t, shiro1_sha5
digest_u32[15] = l32_from_64_S(tmps[gid].dgst[7]);
for (u32 i = 0; i < LOOP_CNT; i++) {
sha512_init(&sha512_ctx);
sha512_update_global(&sha512_ctx, digest_u32, SHA512_DIGEST_LENGTH);
sha512_final(&sha512_ctx);
sha512_init (&sha512_ctx);
sha512_update (&sha512_ctx, digest_u32, SHA512_DIGEST_LENGTH);
sha512_final (&sha512_ctx);
for (int j = 0; j < 8; j++) {
tmps[gid].dgst[j] = sha512_ctx.h[j];
@ -131,12 +121,6 @@ KERNEL_FQ void m12150_comp (KERN_ATTR_TMPS_ESALT (shiro1_sha512_tmp_t, shiro1_sh
if (gid >= GID_CNT) return;
/*printf("Comparing hash: ");
for (int i = 0; i < 8; i++) {
printf("%016llx", tmps[gid].out[i]);
}
printf("\n");*/
const u64 lid = get_local_id (0);
const u64 a = tmps[gid].out[0];

View File

@ -85,4 +85,7 @@ Brandon Chalk <brandon@casaba.com> (@brandoncasaba)
Jamie Riden <jamie@blacktraffic.co.uk>
* Web2py pbkdf2-sha512 plugin
Dylan Evans <fin3ss3g0d@pm.me> (@fin3ss3g0d)
* Apache Shiro 1 SHA-512 plugin
!!! All the package maintainers of hashcat !!!

View File

@ -1,4 +1,8 @@
// https://github.com/hashcat/hashcat/blob/master/docs/hashcat-plugin-development-guide.md
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "modules.h"
@ -120,11 +124,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
/*for (int i = 0; i < token.token_cnt; i++) {
printf("Token %d: %.*s (length: %d)\n", i, token.len[i], token.buf[i], token.len[i]);
}
printf("\n");*/
if (rc_tokenizer != PARSER_OK) { return (rc_tokenizer); }
u8 tmp_buf[512];
@ -140,31 +139,13 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *salt_pos = token.buf[3];
const int salt_len = token.len[3];
memset (tmp_buf, 0, sizeof (tmp_buf));
//printf("Salt (b64): %.*s\n", salt_len, salt_pos);
tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf);
/*printf("Decoded Salt (hex): ");
for (size_t i = 0; i < tmp_len; i++) {
printf("%02x", tmp_buf[i]);
}
printf("\n");*/
memcpy (shiro_sha512->salt_buf, tmp_buf, tmp_len);
salt->salt_len = tmp_len;
salt->salt_buf[0] = shiro_sha512->salt_buf[0];
salt->salt_buf[1] = shiro_sha512->salt_buf[1];
salt->salt_buf[2] = shiro_sha512->salt_buf[2];
salt->salt_buf[3] = shiro_sha512->salt_buf[3];
// Print the salt as u32 values
/*printf("Salt (interpreted as u32): ");
for (int i = 0; i < 4; i++) {
printf("%08x", salt->salt_buf[i]);
}
printf("\n");*/
// Print the salt as bytes for comparison
/*printf("Salt (interpreted as bytes): ");
for (int i = 0; i < tmp_len; i++) {
printf("%02x", ((u8 *)salt->salt_buf)[i]);
}
printf("\n");*/
// hash
const u8 *hash_pos = token.buf[4];
@ -181,11 +162,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
digest[5] = byte_swap_64 (digest[5]);
digest[6] = byte_swap_64 (digest[6]);
digest[7] = byte_swap_64 (digest[7]);
/*printf("Hash: ");
for (int i = 0; i < 8; i++) {
printf("%016llx", digest[i]);
}
printf("\n");*/
return (PARSER_OK);
}
@ -275,4 +251,4 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_tmp_size = module_tmp_size;
module_ctx->module_unstable_warning = MODULE_DEFAULT;
module_ctx->module_warmup_disable = MODULE_DEFAULT;
}
}