1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-02-08 21:52:51 +00:00

Where generic_salt_decode() is used, the generic_salt_encode() should be used, too

This commit is contained in:
jsteube 2019-02-14 13:05:14 +01:00
parent 0096f1a56b
commit 5ef0de45df
91 changed files with 244 additions and 253 deletions

View File

@ -139,9 +139,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -131,9 +131,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -135,9 +135,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -130,9 +130,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -124,18 +124,18 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[3] += MD5M_D; tmp[3] += MD5M_D;
} }
u8 tmp_buf[128]; char tmp_salt[48];
memcpy (tmp_buf, salt->salt_buf, salt->salt_len); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len - 8, (u8 *) tmp_salt);
tmp_buf[salt->salt_len - 8] = 0; tmp_salt[salt_len] = 0;
const int out_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%s", const int out_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%s",
byte_swap_32 (tmp[0]), byte_swap_32 (tmp[0]),
byte_swap_32 (tmp[1]), byte_swap_32 (tmp[1]),
byte_swap_32 (tmp[2]), byte_swap_32 (tmp[2]),
byte_swap_32 (tmp[3]), byte_swap_32 (tmp[3]),
(char *) tmp_buf); tmp_salt);
return out_len; return out_len;
} }

View File

@ -137,9 +137,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -136,9 +136,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -115,9 +115,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -115,9 +115,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -155,9 +155,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -156,9 +156,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, out_buf + out_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len * 2;
return out_len; return out_len;
} }

View File

@ -155,9 +155,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -156,9 +156,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -125,7 +125,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[48]; char tmp_salt[48];
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x",
tmp_salt, tmp_salt,

View File

@ -143,9 +143,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[SALT_MAX]; char tmp_salt[SALT_MAX];
memcpy (tmp_salt, salt->salt_buf, salt->salt_len); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x%08x",
SIGNATURE_DJANGOSHA1, SIGNATURE_DJANGOSHA1,

View File

@ -127,7 +127,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[48]; char tmp_salt[48];
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x",
tmp_salt, tmp_salt,

View File

@ -156,9 +156,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -138,8 +138,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[4] += SHA1M_E; tmp[4] += SHA1M_E;
} }
const int line_len = snprintf (line_buf, line_size, "0x0100%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", char tmp_salt[16];
byte_swap_32 (salt->salt_buf[0]),
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "0x0100%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
tmp_salt,
0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
tmp[0], tmp[0],
tmp[1], tmp[1],

View File

@ -133,8 +133,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[4] += SHA1M_E; tmp[4] += SHA1M_E;
} }
const int line_len = snprintf (line_buf, line_size, "0x0100%08x%08x%08x%08x%08x%08x", char tmp_salt[16];
byte_swap_32 (salt->salt_buf[0]),
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "0x0100%s%08x%08x%08x%08x%08x",
tmp_salt,
tmp[0], tmp[0],
tmp[1], tmp[1],
tmp[2], tmp[2],

View File

@ -156,9 +156,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -128,9 +128,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{ {
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
char ptr_salt[128] = { 0 }; char tmp_salt[128] = { 0 };
base64_encode (int_to_base64, (const u8 *) salt->salt_buf, salt->salt_len, (u8 *) ptr_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
u32 tmp[5]; u32 tmp[5];
@ -161,7 +163,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
ptr_plain[27] = 0; ptr_plain[27] = 0;
const int line_len = snprintf (line_buf, line_size, "%s*0*%s*%s", SIGNATURE_EPISERVER, ptr_salt, ptr_plain); const int line_len = snprintf (line_buf, line_size, "%s*0*%s*%s", SIGNATURE_EPISERVER, tmp_salt, ptr_plain);
return line_len; return line_len;
} }

View File

@ -133,9 +133,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -133,9 +133,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -222,15 +222,21 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
md5crypt_encode (digest_buf, tmp); md5crypt_encode (digest_buf, tmp);
char tmp_salt[16];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
int line_len = 0; int line_len = 0;
if (salt->salt_iter == ROUNDS_MD5CRYPT) if (salt->salt_iter == ROUNDS_MD5CRYPT)
{ {
line_len = snprintf (line_buf, line_size, "$1$%s$%s", (char *) salt->salt_buf, tmp); line_len = snprintf (line_buf, line_size, "$1$%s$%s", tmp_salt, tmp);
} }
else else
{ {
line_len = snprintf (line_buf, line_size, "$1$rounds=%u$%s$%s", salt->salt_iter, (char *) salt->salt_buf, tmp); line_len = snprintf (line_buf, line_size, "$1$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, tmp);
} }
return line_len; return line_len;

View File

@ -176,9 +176,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -176,9 +176,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -137,15 +137,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[7] += SHA256M_H; tmp[7] += SHA256M_H;
} }
const u8 *salt_ptr = (const u8 *) salt->salt_buf; char tmp_salt[16];
const int line_len = snprintf (line_buf, line_size, "%c%c%c%c%c%c%08x%08x%08x%08x%08x%08x%08x%08x", const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
salt_ptr[0],
salt_ptr[1], tmp_salt[salt_len] = 0;
salt_ptr[2],
salt_ptr[3], const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x%08x%08x%08x",
salt_ptr[4], tmp_salt,
salt_ptr[5],
tmp[0], tmp[0],
tmp[1], tmp[1],
tmp[2], tmp[2],

View File

@ -177,9 +177,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -177,9 +177,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -134,9 +134,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{ {
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
char ptr_salt[128] = { 0 }; char tmp_salt[128];
base64_encode (int_to_base64, (const u8 *) salt->salt_buf, salt->salt_len, (u8 *) ptr_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
u32 tmp[8]; u32 tmp[8];
@ -176,7 +178,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
ptr_plain[43] = 0; ptr_plain[43] = 0;
const int line_len = snprintf (line_buf, line_size, "%s*1*%s*%s", SIGNATURE_EPISERVER, ptr_salt, ptr_plain); const int line_len = snprintf (line_buf, line_size, "%s*1*%s*%s", SIGNATURE_EPISERVER, tmp_salt, ptr_plain);
return line_len; return line_len;
} }

View File

@ -147,9 +147,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -148,9 +148,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -222,15 +222,21 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
md5crypt_encode (digest_buf, tmp); md5crypt_encode (digest_buf, tmp);
char tmp_salt[16];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
int line_len = 0; int line_len = 0;
if (salt->salt_iter == ROUNDS_MD5CRYPT) if (salt->salt_iter == ROUNDS_MD5CRYPT)
{ {
line_len = snprintf (line_buf, line_size, "$apr1$%s$%s", (char *) salt->salt_buf, tmp); line_len = snprintf (line_buf, line_size, "$apr1$%s$%s", tmp_salt, tmp);
} }
else else
{ {
line_len = snprintf (line_buf, line_size, "$apr1$rounds=%u$%s$%s", salt->salt_iter, (char *) salt->salt_buf, tmp); line_len = snprintf (line_buf, line_size, "$apr1$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, tmp);
} }
return line_len; return line_len;

View File

@ -177,9 +177,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -177,9 +177,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -141,8 +141,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 *ptr = (u32 *) tmp; u32 *ptr = (u32 *) tmp;
const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", char tmp_salt[16];
byte_swap_32 (salt->salt_buf[0]),
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
tmp_salt,
ptr[ 1], ptr[ 0], ptr[ 1], ptr[ 0],
ptr[ 3], ptr[ 2], ptr[ 3], ptr[ 2],
ptr[ 5], ptr[ 4], ptr[ 5], ptr[ 4],

View File

@ -178,9 +178,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -151,8 +151,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u32 *ptr = (const u32 *) tmp; const u32 *ptr = (const u32 *) tmp;
const int line_len = snprintf (line_buf, line_size, "0x0200%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", char tmp_salt[16];
byte_swap_32 (salt->salt_buf[0]),
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "0x0200%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
tmp_salt,
ptr[ 1], ptr[ 0], ptr[ 1], ptr[ 0],
ptr[ 3], ptr[ 2], ptr[ 3], ptr[ 2],
ptr[ 5], ptr[ 4], ptr[ 5], ptr[ 4],

View File

@ -178,9 +178,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -148,9 +148,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -149,9 +149,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -487,15 +487,21 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sha512crypt_encode (digest_buf, tmp); sha512crypt_encode (digest_buf, tmp);
char tmp_salt[64];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
int line_len = 0; int line_len = 0;
if (salt->salt_iter == ROUNDS_SHA512CRYPT) if (salt->salt_iter == ROUNDS_SHA512CRYPT)
{ {
line_len = snprintf (line_buf, line_size, "$6$%s$%s", (char *) salt->salt_buf, tmp); line_len = snprintf (line_buf, line_size, "$6$%s$%s", tmp_salt, tmp);
} }
else else
{ {
line_len = snprintf (line_buf, line_size, "$6$rounds=%u$%s$%s", salt->salt_iter, (char *) salt->salt_buf, tmp); line_len = snprintf (line_buf, line_size, "$6$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, tmp);
} }
return line_len; return line_len;

View File

@ -144,10 +144,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char *salt_ptr = (char *) salt->salt_buf; char *salt_ptr = (char *) salt->salt_buf;
for (u32 i = 0; i < salt->salt_len; i++) line_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) line_buf + line_len);
{
line_len += snprintf (line_buf + line_len, line_size - line_len, "%c", salt_ptr[i]);
}
line_len += snprintf (line_buf + line_len, line_size - line_len, "#%08x%08x%08x%08x", line_len += snprintf (line_buf + line_len, line_size - line_len, "#%08x%08x%08x%08x",
digest[0], digest[0],

View File

@ -160,9 +160,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -136,9 +136,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -127,9 +127,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[SALT_MAX * 2]; char tmp_salt[SALT_MAX * 2];
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len * 2] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x",
SIGNATURE_PHPS, SIGNATURE_PHPS,

View File

@ -120,9 +120,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -134,9 +134,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -98,9 +98,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
line_len += 1; line_len += 1;
memcpy (line_buf + line_len, salt->salt_buf, salt->salt_len); line_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, line_buf + line_len);
line_len += salt->salt_len;
return line_len; return line_len;
} }

View File

@ -135,9 +135,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -128,9 +128,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[SALT_MAX]; char tmp_salt[SALT_MAX];
memcpy (tmp_salt, salt->salt_buf, salt->salt_len - 1); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len - 1, (u8 *) tmp_salt);
tmp_salt[salt->salt_len - 1] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x",
SIGNATURE_MEDIAWIKI_B, SIGNATURE_MEDIAWIKI_B,

View File

@ -136,9 +136,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -136,9 +136,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -135,9 +135,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -133,9 +133,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -135,9 +135,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -127,9 +127,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -127,9 +127,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -150,9 +150,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -150,9 +150,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -222,7 +222,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
md5crypt_encode (digest_buf, tmp); md5crypt_encode (digest_buf, tmp);
const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_MD5AIX, (char *) salt->salt_buf, tmp); char tmp_salt[16];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_MD5AIX, tmp_salt, tmp);
return line_len; return line_len;
} }

View File

@ -345,7 +345,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sha256aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); sha256aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain);
const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA256AIX, salt->salt_sign[0], (char *) salt->salt_buf, ptr_plain); char tmp_salt[64];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA256AIX, salt->salt_sign[0], tmp_salt, ptr_plain);
return line_len; return line_len;
} }

View File

@ -519,7 +519,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sha512aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); sha512aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain);
const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA512AIX, salt->salt_sign[0], (char *) salt->salt_buf, ptr_plain); char tmp_salt[64];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA512AIX, salt->salt_sign[0], tmp_salt, ptr_plain);
return line_len; return line_len;
} }

View File

@ -272,7 +272,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sha1aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); sha1aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain);
const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA1AIX, salt->salt_sign[0], (char *) salt->salt_buf, ptr_plain); char tmp_salt[64];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA1AIX, salt->salt_sign[0], tmp_salt, ptr_plain);
return line_len; return line_len;
} }

View File

@ -126,13 +126,19 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{ {
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
char tmp_salt[48];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
return snprintf (line_buf, line_size, "%08x%08x%08x%08x:%d:%s", return snprintf (line_buf, line_size, "%08x%08x%08x%08x:%d:%s",
digest[0], digest[0],
digest[1], digest[1],
digest[2], digest[2],
digest[3], digest[3],
salt->salt_iter + 1, salt->salt_iter + 1,
(char *) salt->salt_buf); tmp_salt);
} }
void module_init (module_ctx_t *module_ctx) void module_init (module_ctx_t *module_ctx)

View File

@ -311,15 +311,21 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sha256crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); sha256crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain);
char tmp_salt[32];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
int line_len; int line_len;
if (salt->salt_iter == ROUNDS_SHA256CRYPT) if (salt->salt_iter == ROUNDS_SHA256CRYPT)
{ {
line_len = snprintf (line_buf, line_size, "$5$%s$%s", (char *) salt->salt_buf, ptr_plain); line_len = snprintf (line_buf, line_size, "$5$%s$%s", tmp_salt, ptr_plain);
} }
else else
{ {
line_len = snprintf (line_buf, line_size, "$5$rounds=%u$%s$%s", salt->salt_iter, (char *) salt->salt_buf, ptr_plain); line_len = snprintf (line_buf, line_size, "$5$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, ptr_plain);
} }
return line_len; return line_len;

View File

@ -119,9 +119,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[16]; char tmp_salt[16];
memcpy (tmp_salt, salt->salt_buf, salt->salt_len); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X", tmp_salt, byte_swap_32 (digest[0]), byte_swap_32 (digest[1])); const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X", tmp_salt, byte_swap_32 (digest[0]), byte_swap_32 (digest[1]));

View File

@ -112,9 +112,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[16]; char tmp_salt[16];
memcpy (tmp_salt, salt->salt_buf, salt->salt_len); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X", tmp_salt, byte_swap_32 (digest[0]), byte_swap_32 (digest[1])); const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X", tmp_salt, byte_swap_32 (digest[0]), byte_swap_32 (digest[1]));

View File

@ -126,9 +126,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[16]; char tmp_salt[16];
memcpy (tmp_salt, salt->salt_buf, salt->salt_len); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X%08X%08X%08X", const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X%08X%08X%08X",
tmp_salt, tmp_salt,

View File

@ -119,9 +119,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[16]; char tmp_salt[16];
memcpy (tmp_salt, salt->salt_buf, salt->salt_len); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X%08X%08X%08X", const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X%08X%08X%08X",
tmp_salt, tmp_salt,

View File

@ -121,18 +121,15 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{ {
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
const u8 *salt_ptr = (const u8 *) salt->salt_buf; char tmp_salt[16];
const int line_len = snprintf (line_buf, line_size, "%s%02x%02x%02x%02x%02x%02x%02x%02x%08x%08x%08x%08x%08x%08x%08x%08x", const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s%08x%08x%08x%08x%08x%08x%08x%08x",
SIGNATURE_SYBASEASE, SIGNATURE_SYBASEASE,
salt_ptr[0], tmp_salt,
salt_ptr[1],
salt_ptr[2],
salt_ptr[3],
salt_ptr[4],
salt_ptr[5],
salt_ptr[6],
salt_ptr[7],
digest[0], digest[0],
digest[1], digest[1],
digest[2], digest[2],

View File

@ -187,9 +187,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[128]; char tmp_salt[128];
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len * 2] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s:%s:%s:%u", digest_buf_c, domain_buf_c, tmp_salt, salt->salt_iter); const int line_len = snprintf (line_buf, line_size, "%s:%s:%s:%u", digest_buf_c, domain_buf_c, tmp_salt, salt->salt_iter);

View File

@ -125,9 +125,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -164,7 +164,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
FP (tmp[1], tmp[0], tt); FP (tmp[1], tmp[0], tt);
const int line_len = snprintf (line_buf, line_size, "%s*%s*%08X%08X", SIGNATURE_RACF, (char *) salt->salt_buf, byte_swap_32 (tmp[0]), byte_swap_32 (tmp[1])); char tmp_salt[32];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s*%s*%08X%08X", SIGNATURE_RACF, tmp_salt, byte_swap_32 (tmp[0]), byte_swap_32 (tmp[1]));
return line_len; return line_len;
} }

View File

@ -124,9 +124,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -110,9 +110,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{ {
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
char tmp_salt[64] = { 0 }; char tmp_salt[64];
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s*%08x%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s%s*%08x%08x%08x%08x%08x",
SIGNATURE_MYSQL_AUTH, SIGNATURE_MYSQL_AUTH,

View File

@ -269,13 +269,18 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sprintf (public_key_buf + j, "%02x", ptr[i]); sprintf (public_key_buf + j, "%02x", ptr[i]);
} }
const int line_len = snprintf (line_buf, line_size, "%s%u$%s$%u$%08x%08x$%u$%u$%s$%u$%s", char tmp_salt[48];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%u$%s$%u$%s$%u$%u$%s$%u$%s",
SIGNATURE_BITCOIN_WALLET, SIGNATURE_BITCOIN_WALLET,
cry_master_len * 2, cry_master_len * 2,
cry_master_buf, cry_master_buf,
salt->salt_len * 2, salt_len,
byte_swap_32 (salt->salt_buf[0]), tmp_salt,
byte_swap_32 (salt->salt_buf[1]),
salt->salt_iter + 1, salt->salt_iter + 1,
ckey_len * 2, ckey_len * 2,
ckey_buf, ckey_buf,

View File

@ -91,7 +91,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{ {
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
const int line_len = snprintf (line_buf, line_size, "%08x:%08x", digest[0], salt->salt_buf[0]); char tmp_salt[16];
const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%08x:%s", digest[0], tmp_salt);
return line_len; return line_len;
} }

View File

@ -127,9 +127,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -127,9 +127,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -151,9 +151,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -151,9 +151,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -206,9 +206,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -125,9 +125,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -131,9 +131,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -317,9 +317,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[48]; char tmp_salt[48];
exec_hexify ((const u8 *) salt_in, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt_in, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len * 2] = 0; tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%u*%s**", const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%u*%s**",
SIGNATURE_ITUNES_BACKUP, SIGNATURE_ITUNES_BACKUP,

View File

@ -319,9 +319,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[48]; char tmp_salt[48];
exec_hexify ((const u8 *) salt_in, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt_in, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len * 2] = 0; tmp_salt[salt_len] = 0;
// DPSL // DPSL

View File

@ -181,9 +181,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1; out_len += 1;
memcpy (out_buf + out_len, salt->salt_buf, salt->salt_len); out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
out_len += salt->salt_len;
return out_len; return out_len;
} }

View File

@ -200,7 +200,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char *tmp_salt = (char *) hcmalloc ((salt->salt_len * 2) + 1); char *tmp_salt = (char *) hcmalloc ((salt->salt_len * 2) + 1);
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt_len] = 0;
const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x",
SIGNATURE_ETHEREUM_PBKDF2, SIGNATURE_ETHEREUM_PBKDF2,

View File

@ -410,14 +410,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char *salt_ptr = (char *) salt->salt_buf; char *salt_ptr = (char *) salt->salt_buf;
u8 tmp_buf[128]; char tmp_salt[128];
for (u32 i = 0, j = 0; i < salt->salt_len; i += 1, j += 2) const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
{
u8_to_hex (salt_ptr[i], tmp_buf + j);
}
tmp_buf[salt->salt_len * 2] = 0; tmp_salt[salt_len] = 0;
ethereum_scrypt_t *ethereum_scrypt = (ethereum_scrypt_t *) esalt_buf; ethereum_scrypt_t *ethereum_scrypt = (ethereum_scrypt_t *) esalt_buf;
@ -426,7 +423,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
salt->scrypt_N, salt->scrypt_N,
salt->scrypt_r, salt->scrypt_r,
salt->scrypt_p, salt->scrypt_p,
(char *) tmp_buf, (char *) tmp_salt,
byte_swap_32 (ethereum_scrypt->ciphertext[0]), byte_swap_32 (ethereum_scrypt->ciphertext[0]),
byte_swap_32 (ethereum_scrypt->ciphertext[1]), byte_swap_32 (ethereum_scrypt->ciphertext[1]),
byte_swap_32 (ethereum_scrypt->ciphertext[2]), byte_swap_32 (ethereum_scrypt->ciphertext[2]),

View File

@ -212,9 +212,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_salt[48]; char tmp_salt[48];
exec_hexify ((const u8 *) salt->salt_buf, salt->salt_len, (u8 *) tmp_salt); const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt);
tmp_salt[salt->salt_len * 2] = 0; tmp_salt[salt_len] = 0;
// output: // output: