1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Help jit compilers to optimize -m 10100 main round

This commit is contained in:
jsteube 2022-11-13 07:30:12 +00:00
parent 653f34e9a2
commit 3c3a42737a
3 changed files with 165 additions and 6 deletions

View File

@ -16,11 +16,64 @@
#include M2S(INCLUDE_PATH/inc_simd.cl) #include M2S(INCLUDE_PATH/inc_simd.cl)
#endif #endif
DECLSPEC u64 siphash_rot32_S (const u64 a)
{
vconv64_t in;
in.v64 = a;
vconv64_t out;
out.v32.a = in.v32.b;
out.v32.b = in.v32.a;
return out.v64;
}
DECLSPEC u64x siphash_rot32 (const u64x a)
{
u64x r;
#if VECT_SIZE == 1
r = siphash_rot32_S (a);
#endif
#if VECT_SIZE >= 2
r.s0 = siphash_rot32_S (a.s0);
r.s1 = siphash_rot32_S (a.s1);
#endif
#if VECT_SIZE >= 4
r.s2 = siphash_rot32_S (a.s2);
r.s3 = siphash_rot32_S (a.s3);
#endif
#if VECT_SIZE >= 8
r.s4 = siphash_rot32_S (a.s4);
r.s5 = siphash_rot32_S (a.s5);
r.s6 = siphash_rot32_S (a.s6);
r.s7 = siphash_rot32_S (a.s7);
#endif
#if VECT_SIZE >= 16
r.s8 = siphash_rot32_S (a.s8);
r.s9 = siphash_rot32_S (a.s9);
r.sa = siphash_rot32_S (a.sa);
r.sb = siphash_rot32_S (a.sb);
r.sc = siphash_rot32_S (a.sc);
r.sd = siphash_rot32_S (a.sd);
r.se = siphash_rot32_S (a.se);
r.sf = siphash_rot32_S (a.sf);
#endif
return r;
}
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = hc_rotl64 ((v1), 13); \ (v1) = hc_rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = hc_rotl64 ((v0), 32); \ (v0) = siphash_rot32 ((v0)); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = hc_rotl64 ((v3), 16); \ (v3) = hc_rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
@ -30,7 +83,7 @@
(v2) += (v1); \ (v2) += (v1); \
(v1) = hc_rotl64 ((v1), 17); \ (v1) = hc_rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = hc_rotl64 ((v2), 32) (v2) = siphash_rot32 ((v2))
KERNEL_FQ void m10100_m04 (KERN_ATTR_RULES ()) KERNEL_FQ void m10100_m04 (KERN_ATTR_RULES ())
{ {

View File

@ -14,11 +14,64 @@
#include M2S(INCLUDE_PATH/inc_simd.cl) #include M2S(INCLUDE_PATH/inc_simd.cl)
#endif #endif
DECLSPEC u64 siphash_rot32_S (const u64 a)
{
vconv64_t in;
in.v64 = a;
vconv64_t out;
out.v32.a = in.v32.b;
out.v32.b = in.v32.a;
return out.v64;
}
DECLSPEC u64x siphash_rot32 (const u64x a)
{
u64x r;
#if VECT_SIZE == 1
r = siphash_rot32_S (a);
#endif
#if VECT_SIZE >= 2
r.s0 = siphash_rot32_S (a.s0);
r.s1 = siphash_rot32_S (a.s1);
#endif
#if VECT_SIZE >= 4
r.s2 = siphash_rot32_S (a.s2);
r.s3 = siphash_rot32_S (a.s3);
#endif
#if VECT_SIZE >= 8
r.s4 = siphash_rot32_S (a.s4);
r.s5 = siphash_rot32_S (a.s5);
r.s6 = siphash_rot32_S (a.s6);
r.s7 = siphash_rot32_S (a.s7);
#endif
#if VECT_SIZE >= 16
r.s8 = siphash_rot32_S (a.s8);
r.s9 = siphash_rot32_S (a.s9);
r.sa = siphash_rot32_S (a.sa);
r.sb = siphash_rot32_S (a.sb);
r.sc = siphash_rot32_S (a.sc);
r.sd = siphash_rot32_S (a.sd);
r.se = siphash_rot32_S (a.se);
r.sf = siphash_rot32_S (a.sf);
#endif
return r;
}
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = hc_rotl64 ((v1), 13); \ (v1) = hc_rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = hc_rotl64 ((v0), 32); \ (v0) = siphash_rot32 ((v0)); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = hc_rotl64 ((v3), 16); \ (v3) = hc_rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
@ -28,7 +81,7 @@
(v2) += (v1); \ (v2) += (v1); \
(v1) = hc_rotl64 ((v1), 17); \ (v1) = hc_rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = hc_rotl64 ((v2), 32) (v2) = siphash_rot32 ((v2))
KERNEL_FQ void m10100_m04 (KERN_ATTR_BASIC ()) KERNEL_FQ void m10100_m04 (KERN_ATTR_BASIC ())
{ {

View File

@ -13,11 +13,64 @@
#include M2S(INCLUDE_PATH/inc_simd.cl) #include M2S(INCLUDE_PATH/inc_simd.cl)
#endif #endif
DECLSPEC u64 siphash_rot32_S (const u64 a)
{
vconv64_t in;
in.v64 = a;
vconv64_t out;
out.v32.a = in.v32.b;
out.v32.b = in.v32.a;
return out.v64;
}
DECLSPEC u64x siphash_rot32 (const u64x a)
{
u64x r;
#if VECT_SIZE == 1
r = siphash_rot32_S (a);
#endif
#if VECT_SIZE >= 2
r.s0 = siphash_rot32_S (a.s0);
r.s1 = siphash_rot32_S (a.s1);
#endif
#if VECT_SIZE >= 4
r.s2 = siphash_rot32_S (a.s2);
r.s3 = siphash_rot32_S (a.s3);
#endif
#if VECT_SIZE >= 8
r.s4 = siphash_rot32_S (a.s4);
r.s5 = siphash_rot32_S (a.s5);
r.s6 = siphash_rot32_S (a.s6);
r.s7 = siphash_rot32_S (a.s7);
#endif
#if VECT_SIZE >= 16
r.s8 = siphash_rot32_S (a.s8);
r.s9 = siphash_rot32_S (a.s9);
r.sa = siphash_rot32_S (a.sa);
r.sb = siphash_rot32_S (a.sb);
r.sc = siphash_rot32_S (a.sc);
r.sd = siphash_rot32_S (a.sd);
r.se = siphash_rot32_S (a.se);
r.sf = siphash_rot32_S (a.sf);
#endif
return r;
}
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = hc_rotl64 ((v1), 13); \ (v1) = hc_rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = hc_rotl64 ((v0), 32); \ (v0) = siphash_rot32 ((v0)); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = hc_rotl64 ((v3), 16); \ (v3) = hc_rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
@ -27,7 +80,7 @@
(v2) += (v1); \ (v2) += (v1); \
(v1) = hc_rotl64 ((v1), 17); \ (v1) = hc_rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = hc_rotl64 ((v2), 32) (v2) = siphash_rot32 ((v2))
DECLSPEC void m10100m (PRIVATE_AS u32 *w, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) DECLSPEC void m10100m (PRIVATE_AS u32 *w, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ())
{ {