Precomputing salt / debugging module files
#1
Hello,

I'd like to create mode simillar to already existing one: 3910 - md5(md5($pass).md5($salt)) although I'd like to replace md5($salt) with sha1($salt)

I decided to precompute salt in module file as it's done in 3910 but I can't really make it work. I also noticed that mode 21200 - md5(sha1($salt).md5($pass)) doesn't precompute salt in the module file. That makes me wonder is there something missing in hashcat source that makes it impossible to implement it?

I've made few attempts to write the precompute function for sha1 salt by myself but apparently I failed, because by using printfs in the kernel it seems that sha1 hash is indeed passed to the salt buffer, but it's  most certainly not the sha1 hash of the test salt I use.

So I wonder maybe I should receive any tips or at least help with debugging module file, because I have no clue how to do this.

This is the code I modified from 3910 module. I assumed I have to swap the salt.


Code:
static void precompute_salt_sha1 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc)
{
  u32 digest[5] = { 0 };
  u32 saltSwapped[4] = { 0 };

  saltSwapped[0] = byte_swap_32 (salt_buf[0]);
  saltSwapped[1] = byte_swap_32 (salt_buf[1]);
  saltSwapped[2] = byte_swap_32 (salt_buf[2]);
  saltSwapped[3] = byte_swap_32 (salt_buf[3]);

  sha1_ctx_t sha1_ctx;

  sha1_init (&sha1_ctx);
  sha1_update (&sha1_ctx, saltSwapped, salt_len);
  sha1_final (&sha1_ctx);

  digest[0] = sha1_ctx.h[0];
  digest[1] = sha1_ctx.h[1];
  digest[2] = sha1_ctx.h[2];
  digest[3] = sha1_ctx.h[3];
  digest[4] = sha1_ctx.h[4];

  u32_to_hex (digest[0], salt_pc + 0);
  u32_to_hex (digest[1], salt_pc + 8);
  u32_to_hex (digest[2], salt_pc + 16);
  u32_to_hex (digest[3], salt_pc + 24);
  u32_to_hex (digest[4], salt_pc + 32);
}
Reply


Messages In This Thread
Precomputing salt / debugging module files - by AndrewOnDev - 07-22-2020, 11:42 PM