1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-21 23:58:07 +00:00

cosmetic: minor code style fixes

This commit is contained in:
philsmd 2020-06-13 11:19:00 +02:00
parent 323e7463b8
commit e59f61e8cf
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF
120 changed files with 895 additions and 888 deletions

View File

@ -384,28 +384,28 @@
/* the linear transformation and its inverse */
#define rot(a,b,c,d) \
a = hc_rotl32_S(a, 13); \
c = hc_rotl32_S(c, 3); \
a = hc_rotl32_S (a, 13); \
c = hc_rotl32_S (c, 3); \
d ^= c ^ (a << 3); \
b ^= a ^ c; \
d = hc_rotl32_S(d, 7); \
b = hc_rotl32_S(b, 1); \
d = hc_rotl32_S (d, 7); \
b = hc_rotl32_S (b, 1); \
a ^= b ^ d; \
c ^= d ^ (b << 7); \
a = hc_rotl32_S(a, 5); \
c = hc_rotl32_S(c, 22)
a = hc_rotl32_S (a, 5); \
c = hc_rotl32_S (c, 22)
#define irot(a,b,c,d) \
c = hc_rotr32_S(c, 22); \
a = hc_rotr32_S(a, 5); \
c = hc_rotr32_S (c, 22); \
a = hc_rotr32_S (a, 5); \
c ^= d ^ (b << 7); \
a ^= b ^ d; \
d = hc_rotr32_S(d, 7); \
b = hc_rotr32_S(b, 1); \
d = hc_rotr32_S (d, 7); \
b = hc_rotr32_S (b, 1); \
d ^= c ^ (a << 3); \
b ^= a ^ c; \
c = hc_rotr32_S(c, 3); \
a = hc_rotr32_S(a, 13)
c = hc_rotr32_S (c, 3); \
a = hc_rotr32_S (a, 13)
// 128 bit key

View File

@ -38,7 +38,7 @@ typedef struct blake2
d = hc_rotr64 (d ^ a, 16); \
c = c + d; \
b = hc_rotr64 (b ^ c, 63); \
} while(0)
} while (0)
#define BLAKE2B_ROUND(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,ca,cb,cc,cd,ce,cf) \
do { \
@ -50,7 +50,7 @@ typedef struct blake2
BLAKE2B_G ((ca),(cb),v[ 1],v[ 6],v[11],v[12]); \
BLAKE2B_G ((cc),(cd),v[ 2],v[ 7],v[ 8],v[13]); \
BLAKE2B_G ((ce),(cf),v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
} while (0)
DECLSPEC void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
{
@ -195,7 +195,7 @@ KERNEL_FQ void m00600_m04 (KERN_ATTR_RULES_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -206,12 +206,12 @@ KERNEL_FQ void m00600_m04 (KERN_ATTR_RULES_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -314,7 +314,7 @@ KERNEL_FQ void m00600_s04 (KERN_ATTR_RULES_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -325,12 +325,12 @@ KERNEL_FQ void m00600_s04 (KERN_ATTR_RULES_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -36,7 +36,7 @@ typedef struct blake2
d = hc_rotr64 (d ^ a, 16); \
c = c + d; \
b = hc_rotr64 (b ^ c, 63); \
} while(0)
} while (0)
#define BLAKE2B_ROUND(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,ca,cb,cc,cd,ce,cf) \
do { \
@ -48,7 +48,7 @@ typedef struct blake2
BLAKE2B_G ((ca),(cb),v[ 1],v[ 6],v[11],v[12]); \
BLAKE2B_G ((cc),(cd),v[ 2],v[ 7],v[ 8],v[13]); \
BLAKE2B_G ((ce),(cf),v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
} while (0)
DECLSPEC void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
{
@ -250,7 +250,7 @@ KERNEL_FQ void m00600_m04 (KERN_ATTR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -261,12 +261,12 @@ KERNEL_FQ void m00600_m04 (KERN_ATTR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -429,7 +429,7 @@ KERNEL_FQ void m00600_s04 (KERN_ATTR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -440,12 +440,12 @@ KERNEL_FQ void m00600_s04 (KERN_ATTR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -36,7 +36,7 @@ typedef struct blake2
d = hc_rotr64 (d ^ a, 16); \
c = c + d; \
b = hc_rotr64 (b ^ c, 63); \
} while(0)
} while (0)
#define BLAKE2B_ROUND(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,ca,cb,cc,cd,ce,cf) \
do { \
@ -48,7 +48,7 @@ typedef struct blake2
BLAKE2B_G ((ca),(cb),v[ 1],v[ 6],v[11],v[12]); \
BLAKE2B_G ((cc),(cd),v[ 2],v[ 7],v[ 8],v[13]); \
BLAKE2B_G ((ce),(cf),v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
} while (0)
DECLSPEC void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
{
@ -198,7 +198,7 @@ KERNEL_FQ void m00600_m04 (KERN_ATTR_VECTOR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -209,12 +209,12 @@ KERNEL_FQ void m00600_m04 (KERN_ATTR_VECTOR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -302,7 +302,7 @@ KERNEL_FQ void m00600_m08 (KERN_ATTR_VECTOR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -313,12 +313,12 @@ KERNEL_FQ void m00600_m08 (KERN_ATTR_VECTOR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -406,7 +406,7 @@ KERNEL_FQ void m00600_m16 (KERN_ATTR_VECTOR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -417,12 +417,12 @@ KERNEL_FQ void m00600_m16 (KERN_ATTR_VECTOR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -522,7 +522,7 @@ KERNEL_FQ void m00600_s04 (KERN_ATTR_VECTOR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -533,12 +533,12 @@ KERNEL_FQ void m00600_s04 (KERN_ATTR_VECTOR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}
@ -638,7 +638,7 @@ KERNEL_FQ void m00600_s08 (KERN_ATTR_VECTOR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -649,12 +649,12 @@ KERNEL_FQ void m00600_s08 (KERN_ATTR_VECTOR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}
@ -754,7 +754,7 @@ KERNEL_FQ void m00600_s16 (KERN_ATTR_VECTOR_ESALT (blake2_t))
f[0] = tmp_f[0];
f[1] = tmp_f[1];
blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
blake2b_transform (h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL);
digest[0] = h[0];
digest[1] = h[1];
@ -765,11 +765,11 @@ KERNEL_FQ void m00600_s16 (KERN_ATTR_VECTOR_ESALT (blake2_t))
digest[6] = h[6];
digest[7] = h[7];
const u32x r0 = h32_from_64(digest[0]);
const u32x r1 = l32_from_64(digest[0]);
const u32x r2 = h32_from_64(digest[1]);
const u32x r3 = l32_from_64(digest[1]);
const u32x r0 = h32_from_64 (digest[0]);
const u32x r1 = l32_from_64 (digest[0]);
const u32x r2 = h32_from_64 (digest[1]);
const u32x r3 = l32_from_64 (digest[1]);
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -57,31 +57,31 @@
DECLSPEC void s1 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(xAA55AA5500550055, a1, a4, a6, 0xC1)
LUT(xA55AA55AF0F5F0F5, a3, a6, xAA55AA5500550055, 0x9E)
LUT(x5F5F5F5FA5A5A5A5, a1, a3, a6, 0xD6)
LUT(xF5A0F5A0A55AA55A, a4, xAA55AA5500550055, x5F5F5F5FA5A5A5A5, 0x56)
LUT(x947A947AD1E7D1E7, a2, xA55AA55AF0F5F0F5, xF5A0F5A0A55AA55A, 0x6C)
LUT(x5FFF5FFFFFFAFFFA, a6, xAA55AA5500550055, x5F5F5F5FA5A5A5A5, 0x7B)
LUT(xB96CB96C69936993, a2, xF5A0F5A0A55AA55A, x5FFF5FFFFFFAFFFA, 0xD6)
LUT(x3, a5, x947A947AD1E7D1E7, xB96CB96C69936993, 0x6A)
LUT(x55EE55EE55EE55EE, a1, a2, a4, 0x7A)
LUT(x084C084CB77BB77B, a2, a6, xF5A0F5A0A55AA55A, 0xC9)
LUT(x9C329C32E295E295, x947A947AD1E7D1E7, x55EE55EE55EE55EE, x084C084CB77BB77B, 0x72)
LUT(xA51EA51E50E050E0, a3, a6, x55EE55EE55EE55EE, 0x29)
LUT(x4AD34AD3BE3CBE3C, a2, x947A947AD1E7D1E7, xA51EA51E50E050E0, 0x95)
LUT(x2, a5, x9C329C32E295E295, x4AD34AD3BE3CBE3C, 0xC6)
LUT(xD955D95595D195D1, a1, a2, x9C329C32E295E295, 0xD2)
LUT(x8058805811621162, x947A947AD1E7D1E7, x55EE55EE55EE55EE, x084C084CB77BB77B, 0x90)
LUT(x7D0F7D0FC4B3C4B3, xA51EA51E50E050E0, xD955D95595D195D1, x8058805811621162, 0x76)
LUT(x0805080500010001, a3, xAA55AA5500550055, xD955D95595D195D1, 0x80)
LUT(x4A964A96962D962D, xB96CB96C69936993, x4AD34AD3BE3CBE3C, x0805080500010001, 0xA6)
LUT(x4, a5, x7D0F7D0FC4B3C4B3, x4A964A96962D962D, 0xA6)
LUT(x148014807B087B08, a1, xAA55AA5500550055, x947A947AD1E7D1E7, 0x21)
LUT(x94D894D86B686B68, xA55AA55AF0F5F0F5, x8058805811621162, x148014807B087B08, 0x6A)
LUT(x5555555540044004, a1, a6, x084C084CB77BB77B, 0x70)
LUT(xAFB4AFB4BF5BBF5B, x5F5F5F5FA5A5A5A5, xA51EA51E50E050E0, x5555555540044004, 0x97)
LUT(x1, a5, x94D894D86B686B68, xAFB4AFB4BF5BBF5B, 0x6C)
LUT (xAA55AA5500550055, a1, a4, a6, 0xC1)
LUT (xA55AA55AF0F5F0F5, a3, a6, xAA55AA5500550055, 0x9E)
LUT (x5F5F5F5FA5A5A5A5, a1, a3, a6, 0xD6)
LUT (xF5A0F5A0A55AA55A, a4, xAA55AA5500550055, x5F5F5F5FA5A5A5A5, 0x56)
LUT (x947A947AD1E7D1E7, a2, xA55AA55AF0F5F0F5, xF5A0F5A0A55AA55A, 0x6C)
LUT (x5FFF5FFFFFFAFFFA, a6, xAA55AA5500550055, x5F5F5F5FA5A5A5A5, 0x7B)
LUT (xB96CB96C69936993, a2, xF5A0F5A0A55AA55A, x5FFF5FFFFFFAFFFA, 0xD6)
LUT (x3, a5, x947A947AD1E7D1E7, xB96CB96C69936993, 0x6A)
LUT (x55EE55EE55EE55EE, a1, a2, a4, 0x7A)
LUT (x084C084CB77BB77B, a2, a6, xF5A0F5A0A55AA55A, 0xC9)
LUT (x9C329C32E295E295, x947A947AD1E7D1E7, x55EE55EE55EE55EE, x084C084CB77BB77B, 0x72)
LUT (xA51EA51E50E050E0, a3, a6, x55EE55EE55EE55EE, 0x29)
LUT (x4AD34AD3BE3CBE3C, a2, x947A947AD1E7D1E7, xA51EA51E50E050E0, 0x95)
LUT (x2, a5, x9C329C32E295E295, x4AD34AD3BE3CBE3C, 0xC6)
LUT (xD955D95595D195D1, a1, a2, x9C329C32E295E295, 0xD2)
LUT (x8058805811621162, x947A947AD1E7D1E7, x55EE55EE55EE55EE, x084C084CB77BB77B, 0x90)
LUT (x7D0F7D0FC4B3C4B3, xA51EA51E50E050E0, xD955D95595D195D1, x8058805811621162, 0x76)
LUT (x0805080500010001, a3, xAA55AA5500550055, xD955D95595D195D1, 0x80)
LUT (x4A964A96962D962D, xB96CB96C69936993, x4AD34AD3BE3CBE3C, x0805080500010001, 0xA6)
LUT (x4, a5, x7D0F7D0FC4B3C4B3, x4A964A96962D962D, 0xA6)
LUT (x148014807B087B08, a1, xAA55AA5500550055, x947A947AD1E7D1E7, 0x21)
LUT (x94D894D86B686B68, xA55AA55AF0F5F0F5, x8058805811621162, x148014807B087B08, 0x6A)
LUT (x5555555540044004, a1, a6, x084C084CB77BB77B, 0x70)
LUT (xAFB4AFB4BF5BBF5B, x5F5F5F5FA5A5A5A5, xA51EA51E50E050E0, x5555555540044004, 0x97)
LUT (x1, a5, x94D894D86B686B68, xAFB4AFB4BF5BBF5B, 0x6C)
*out1 ^= x1;
*out2 ^= x2;
@ -91,30 +91,30 @@ DECLSPEC void s1 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s2 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(xEEEEEEEE99999999, a1, a2, a6, 0x97)
LUT(xFFFFEEEE66666666, a5, a6, xEEEEEEEE99999999, 0x67)
LUT(x5555FFFFFFFF0000, a1, a5, a6, 0x76)
LUT(x6666DDDD5555AAAA, a2, xFFFFEEEE66666666, x5555FFFFFFFF0000, 0x69)
LUT(x6969D3D35353ACAC, a3, xFFFFEEEE66666666, x6666DDDD5555AAAA, 0x6A)
LUT(xCFCF3030CFCF3030, a2, a3, a5, 0x65)
LUT(xE4E4EEEE9999F0F0, a3, xEEEEEEEE99999999, x5555FFFFFFFF0000, 0x8D)
LUT(xE5E5BABACDCDB0B0, a1, xCFCF3030CFCF3030, xE4E4EEEE9999F0F0, 0xCA)
LUT(x3, a4, x6969D3D35353ACAC, xE5E5BABACDCDB0B0, 0xC6)
LUT(x3333CCCC00000000, a2, a5, a6, 0x14)
LUT(xCCCCDDDDFFFF0F0F, a5, xE4E4EEEE9999F0F0, x3333CCCC00000000, 0xB5)
LUT(x00000101F0F0F0F0, a3, a6, xFFFFEEEE66666666, 0x1C)
LUT(x9A9A64646A6A9595, a1, xCFCF3030CFCF3030, x00000101F0F0F0F0, 0x96)
LUT(x2, a4, xCCCCDDDDFFFF0F0F, x9A9A64646A6A9595, 0x6A)
LUT(x3333BBBB3333FFFF, a1, a2, x6666DDDD5555AAAA, 0xDE)
LUT(x1414141441410000, a1, a3, xE4E4EEEE9999F0F0, 0x90)
LUT(x7F7FF3F3F5F53939, x6969D3D35353ACAC, x9A9A64646A6A9595, x3333BBBB3333FFFF, 0x79)
LUT(x9494E3E34B4B3939, a5, x1414141441410000, x7F7FF3F3F5F53939, 0x29)
LUT(x1, a4, x3333BBBB3333FFFF, x9494E3E34B4B3939, 0xA6)
LUT(xB1B1BBBBCCCCA5A5, a1, a1, xE4E4EEEE9999F0F0, 0x4A)
LUT(xFFFFECECEEEEDDDD, a2, x3333CCCC00000000, x9A9A64646A6A9595, 0xEF)
LUT(xB1B1A9A9DCDC8787, xE5E5BABACDCDB0B0, xB1B1BBBBCCCCA5A5, xFFFFECECEEEEDDDD, 0x8D)
LUT(xFFFFCCCCEEEE4444, a2, a5, xFFFFEEEE66666666, 0x2B)
LUT(x4, a4, xB1B1A9A9DCDC8787, xFFFFCCCCEEEE4444, 0x6C)
LUT (xEEEEEEEE99999999, a1, a2, a6, 0x97)
LUT (xFFFFEEEE66666666, a5, a6, xEEEEEEEE99999999, 0x67)
LUT (x5555FFFFFFFF0000, a1, a5, a6, 0x76)
LUT (x6666DDDD5555AAAA, a2, xFFFFEEEE66666666, x5555FFFFFFFF0000, 0x69)
LUT (x6969D3D35353ACAC, a3, xFFFFEEEE66666666, x6666DDDD5555AAAA, 0x6A)
LUT (xCFCF3030CFCF3030, a2, a3, a5, 0x65)
LUT (xE4E4EEEE9999F0F0, a3, xEEEEEEEE99999999, x5555FFFFFFFF0000, 0x8D)
LUT (xE5E5BABACDCDB0B0, a1, xCFCF3030CFCF3030, xE4E4EEEE9999F0F0, 0xCA)
LUT (x3, a4, x6969D3D35353ACAC, xE5E5BABACDCDB0B0, 0xC6)
LUT (x3333CCCC00000000, a2, a5, a6, 0x14)
LUT (xCCCCDDDDFFFF0F0F, a5, xE4E4EEEE9999F0F0, x3333CCCC00000000, 0xB5)
LUT (x00000101F0F0F0F0, a3, a6, xFFFFEEEE66666666, 0x1C)
LUT (x9A9A64646A6A9595, a1, xCFCF3030CFCF3030, x00000101F0F0F0F0, 0x96)
LUT (x2, a4, xCCCCDDDDFFFF0F0F, x9A9A64646A6A9595, 0x6A)
LUT (x3333BBBB3333FFFF, a1, a2, x6666DDDD5555AAAA, 0xDE)
LUT (x1414141441410000, a1, a3, xE4E4EEEE9999F0F0, 0x90)
LUT (x7F7FF3F3F5F53939, x6969D3D35353ACAC, x9A9A64646A6A9595, x3333BBBB3333FFFF, 0x79)
LUT (x9494E3E34B4B3939, a5, x1414141441410000, x7F7FF3F3F5F53939, 0x29)
LUT (x1, a4, x3333BBBB3333FFFF, x9494E3E34B4B3939, 0xA6)
LUT (xB1B1BBBBCCCCA5A5, a1, a1, xE4E4EEEE9999F0F0, 0x4A)
LUT (xFFFFECECEEEEDDDD, a2, x3333CCCC00000000, x9A9A64646A6A9595, 0xEF)
LUT (xB1B1A9A9DCDC8787, xE5E5BABACDCDB0B0, xB1B1BBBBCCCCA5A5, xFFFFECECEEEEDDDD, 0x8D)
LUT (xFFFFCCCCEEEE4444, a2, a5, xFFFFEEEE66666666, 0x2B)
LUT (x4, a4, xB1B1A9A9DCDC8787, xFFFFCCCCEEEE4444, 0x6C)
*out1 ^= x1;
*out2 ^= x2;
@ -124,31 +124,31 @@ DECLSPEC void s2 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s3 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(xA50FA50FA50FA50F, a1, a3, a4, 0xC9)
LUT(xF0F00F0FF0F0F0F0, a3, a5, a6, 0x4B)
LUT(xAF0FA0AAAF0FAF0F, a1, xA50FA50FA50FA50F, xF0F00F0FF0F0F0F0, 0x4D)
LUT(x5AA5A55A5AA55AA5, a1, a4, xF0F00F0FF0F0F0F0, 0x69)
LUT(xAA005FFFAA005FFF, a3, a5, xA50FA50FA50FA50F, 0xD6)
LUT(x5AA5A55A0F5AFAA5, a6, x5AA5A55A5AA55AA5, xAA005FFFAA005FFF, 0x9C)
LUT(x1, a2, xAF0FA0AAAF0FAF0F, x5AA5A55A0F5AFAA5, 0xA6)
LUT(xAA55AA5500AA00AA, a1, a4, a6, 0x49)
LUT(xFAFAA50FFAFAA50F, a1, a5, xA50FA50FA50FA50F, 0x9B)
LUT(x50AF0F5AFA50A5A5, a1, xAA55AA5500AA00AA, xFAFAA50FFAFAA50F, 0x66)
LUT(xAFAFAFAFFAFAFAFA, a1, a3, a6, 0x6F)
LUT(xAFAFFFFFFFFAFAFF, a4, x50AF0F5AFA50A5A5, xAFAFAFAFFAFAFAFA, 0xEB)
LUT(x4, a2, x50AF0F5AFA50A5A5, xAFAFFFFFFFFAFAFF, 0x6C)
LUT(x500F500F500F500F, a1, a3, a4, 0x98)
LUT(xF0505A0505A5050F, x5AA5A55A0F5AFAA5, xAA55AA5500AA00AA, xAFAFAFAFFAFAFAFA, 0x1D)
LUT(xF0505A05AA55AAFF, a6, x500F500F500F500F, xF0505A0505A5050F, 0x9A)
LUT(xFF005F55FF005F55, a1, a4, xAA005FFFAA005FFF, 0xB2)
LUT(xA55F5AF0A55F5AF0, a5, xA50FA50FA50FA50F, x5AA5A55A5AA55AA5, 0x3D)
LUT(x5A5F05A5A55F5AF0, a6, xFF005F55FF005F55, xA55F5AF0A55F5AF0, 0xA6)
LUT(x3, a2, xF0505A05AA55AAFF, x5A5F05A5A55F5AF0, 0xA6)
LUT(x0F0F0F0FA5A5A5A5, a1, a3, a6, 0xC6)
LUT(x5FFFFF5FFFA0FFA0, x5AA5A55A5AA55AA5, xAFAFAFAFFAFAFAFA, x0F0F0F0FA5A5A5A5, 0xDB)
LUT(xF5555AF500A05FFF, a5, xFAFAA50FFAFAA50F, xF0505A0505A5050F, 0xB9)
LUT(x05A5AAF55AFA55A5, xF0505A05AA55AAFF, x0F0F0F0FA5A5A5A5, xF5555AF500A05FFF, 0x9B)
LUT(x2, a2, x5FFFFF5FFFA0FFA0, x05A5AAF55AFA55A5, 0xA6)
LUT (xA50FA50FA50FA50F, a1, a3, a4, 0xC9)
LUT (xF0F00F0FF0F0F0F0, a3, a5, a6, 0x4B)
LUT (xAF0FA0AAAF0FAF0F, a1, xA50FA50FA50FA50F, xF0F00F0FF0F0F0F0, 0x4D)
LUT (x5AA5A55A5AA55AA5, a1, a4, xF0F00F0FF0F0F0F0, 0x69)
LUT (xAA005FFFAA005FFF, a3, a5, xA50FA50FA50FA50F, 0xD6)
LUT (x5AA5A55A0F5AFAA5, a6, x5AA5A55A5AA55AA5, xAA005FFFAA005FFF, 0x9C)
LUT (x1, a2, xAF0FA0AAAF0FAF0F, x5AA5A55A0F5AFAA5, 0xA6)
LUT (xAA55AA5500AA00AA, a1, a4, a6, 0x49)
LUT (xFAFAA50FFAFAA50F, a1, a5, xA50FA50FA50FA50F, 0x9B)
LUT (x50AF0F5AFA50A5A5, a1, xAA55AA5500AA00AA, xFAFAA50FFAFAA50F, 0x66)
LUT (xAFAFAFAFFAFAFAFA, a1, a3, a6, 0x6F)
LUT (xAFAFFFFFFFFAFAFF, a4, x50AF0F5AFA50A5A5, xAFAFAFAFFAFAFAFA, 0xEB)
LUT (x4, a2, x50AF0F5AFA50A5A5, xAFAFFFFFFFFAFAFF, 0x6C)
LUT (x500F500F500F500F, a1, a3, a4, 0x98)
LUT (xF0505A0505A5050F, x5AA5A55A0F5AFAA5, xAA55AA5500AA00AA, xAFAFAFAFFAFAFAFA, 0x1D)
LUT (xF0505A05AA55AAFF, a6, x500F500F500F500F, xF0505A0505A5050F, 0x9A)
LUT (xFF005F55FF005F55, a1, a4, xAA005FFFAA005FFF, 0xB2)
LUT (xA55F5AF0A55F5AF0, a5, xA50FA50FA50FA50F, x5AA5A55A5AA55AA5, 0x3D)
LUT (x5A5F05A5A55F5AF0, a6, xFF005F55FF005F55, xA55F5AF0A55F5AF0, 0xA6)
LUT (x3, a2, xF0505A05AA55AAFF, x5A5F05A5A55F5AF0, 0xA6)
LUT (x0F0F0F0FA5A5A5A5, a1, a3, a6, 0xC6)
LUT (x5FFFFF5FFFA0FFA0, x5AA5A55A5AA55AA5, xAFAFAFAFFAFAFAFA, x0F0F0F0FA5A5A5A5, 0xDB)
LUT (xF5555AF500A05FFF, a5, xFAFAA50FFAFAA50F, xF0505A0505A5050F, 0xB9)
LUT (x05A5AAF55AFA55A5, xF0505A05AA55AAFF, x0F0F0F0FA5A5A5A5, xF5555AF500A05FFF, 0x9B)
LUT (x2, a2, x5FFFFF5FFFA0FFA0, x05A5AAF55AFA55A5, 0xA6)
*out1 ^= x1;
*out2 ^= x2;
@ -158,24 +158,24 @@ DECLSPEC void s3 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s4 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(x55F055F055F055F0, a1, a3, a4, 0x72)
LUT(xA500F5F0A500F5F0, a3, a5, x55F055F055F055F0, 0xAD)
LUT(xF50AF50AF50AF50A, a1, a3, a4, 0x59)
LUT(xF5FA0FFFF5FA0FFF, a3, a5, xF50AF50AF50AF50A, 0xE7)
LUT(x61C8F93C61C8F93C, a2, xA500F5F0A500F5F0, xF5FA0FFFF5FA0FFF, 0xC6)
LUT(x9999666699996666, a1, a2, a5, 0x69)
LUT(x22C022C022C022C0, a2, a4, x55F055F055F055F0, 0x18)
LUT(xB35C94A6B35C94A6, xF5FA0FFFF5FA0FFF, x9999666699996666, x22C022C022C022C0, 0x63)
LUT(x4, a6, x61C8F93C61C8F93C, xB35C94A6B35C94A6, 0x6A)
LUT(x4848484848484848, a1, a2, a3, 0x12)
LUT(x55500AAA55500AAA, a1, a5, xF5FA0FFFF5FA0FFF, 0x28)
LUT(x3C90B3D63C90B3D6, x61C8F93C61C8F93C, x4848484848484848, x55500AAA55500AAA, 0x1E)
LUT(x8484333384843333, a1, x9999666699996666, x4848484848484848, 0x14)
LUT(x4452F1AC4452F1AC, xF50AF50AF50AF50A, xF5FA0FFFF5FA0FFF, xB35C94A6B35C94A6, 0x78)
LUT(x9586CA379586CA37, x55500AAA55500AAA, x8484333384843333, x4452F1AC4452F1AC, 0xD6)
LUT(x2, a6, x3C90B3D63C90B3D6, x9586CA379586CA37, 0x6A)
LUT(x1, a6, x3C90B3D63C90B3D6, x9586CA379586CA37, 0xA9)
LUT(x3, a6, x61C8F93C61C8F93C, xB35C94A6B35C94A6, 0x56)
LUT (x55F055F055F055F0, a1, a3, a4, 0x72)
LUT (xA500F5F0A500F5F0, a3, a5, x55F055F055F055F0, 0xAD)
LUT (xF50AF50AF50AF50A, a1, a3, a4, 0x59)
LUT (xF5FA0FFFF5FA0FFF, a3, a5, xF50AF50AF50AF50A, 0xE7)
LUT (x61C8F93C61C8F93C, a2, xA500F5F0A500F5F0, xF5FA0FFFF5FA0FFF, 0xC6)
LUT (x9999666699996666, a1, a2, a5, 0x69)
LUT (x22C022C022C022C0, a2, a4, x55F055F055F055F0, 0x18)
LUT (xB35C94A6B35C94A6, xF5FA0FFFF5FA0FFF, x9999666699996666, x22C022C022C022C0, 0x63)
LUT (x4, a6, x61C8F93C61C8F93C, xB35C94A6B35C94A6, 0x6A)
LUT (x4848484848484848, a1, a2, a3, 0x12)
LUT (x55500AAA55500AAA, a1, a5, xF5FA0FFFF5FA0FFF, 0x28)
LUT (x3C90B3D63C90B3D6, x61C8F93C61C8F93C, x4848484848484848, x55500AAA55500AAA, 0x1E)
LUT (x8484333384843333, a1, x9999666699996666, x4848484848484848, 0x14)
LUT (x4452F1AC4452F1AC, xF50AF50AF50AF50A, xF5FA0FFFF5FA0FFF, xB35C94A6B35C94A6, 0x78)
LUT (x9586CA379586CA37, x55500AAA55500AAA, x8484333384843333, x4452F1AC4452F1AC, 0xD6)
LUT (x2, a6, x3C90B3D63C90B3D6, x9586CA379586CA37, 0x6A)
LUT (x1, a6, x3C90B3D63C90B3D6, x9586CA379586CA37, 0xA9)
LUT (x3, a6, x61C8F93C61C8F93C, xB35C94A6B35C94A6, 0x56)
*out1 ^= x1;
*out2 ^= x2;
@ -185,31 +185,31 @@ DECLSPEC void s4 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s5 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(xA0A0A0A0FFFFFFFF, a1, a3, a6, 0xAB)
LUT(xFFFF00005555FFFF, a1, a5, a6, 0xB9)
LUT(xB3B320207777FFFF, a2, xA0A0A0A0FFFFFFFF, xFFFF00005555FFFF, 0xE8)
LUT(x50505A5A5A5A5050, a1, a3, xFFFF00005555FFFF, 0x34)
LUT(xA2A2FFFF2222FFFF, a1, a5, xB3B320207777FFFF, 0xCE)
LUT(x2E2E6969A4A46363, a2, x50505A5A5A5A5050, xA2A2FFFF2222FFFF, 0x29)
LUT(x3, a4, xB3B320207777FFFF, x2E2E6969A4A46363, 0xA6)
LUT(xA5A50A0AA5A50A0A, a1, a3, a5, 0x49)
LUT(x969639396969C6C6, a2, a6, xA5A50A0AA5A50A0A, 0x96)
LUT(x1B1B1B1B1B1B1B1B, a1, a2, a3, 0xCA)
LUT(xBFBFBFBFF6F6F9F9, a3, xA0A0A0A0FFFFFFFF, x969639396969C6C6, 0x7E)
LUT(x5B5BA4A4B8B81D1D, xFFFF00005555FFFF, x1B1B1B1B1B1B1B1B, xBFBFBFBFF6F6F9F9, 0x96)
LUT(x2, a4, x969639396969C6C6, x5B5BA4A4B8B81D1D, 0xCA)
LUT(x5555BBBBFFFF5555, a1, a2, xFFFF00005555FFFF, 0xE5)
LUT(x6D6D9C9C95956969, x50505A5A5A5A5050, xA2A2FFFF2222FFFF, x969639396969C6C6, 0x97)
LUT(x1A1A67676A6AB4B4, xA5A50A0AA5A50A0A, x5555BBBBFFFF5555, x6D6D9C9C95956969, 0x47)
LUT(xA0A0FFFFAAAA0000, a3, xFFFF00005555FFFF, xA5A50A0AA5A50A0A, 0x3B)
LUT(x36369C9CC1C1D6D6, x969639396969C6C6, x6D6D9C9C95956969, xA0A0FFFFAAAA0000, 0xD9)
LUT(x1, a4, x1A1A67676A6AB4B4, x36369C9CC1C1D6D6, 0xCA)
LUT(x5555F0F0F5F55555, a1, a3, xFFFF00005555FFFF, 0xB1)
LUT(x79790202DCDC0808, xA2A2FFFF2222FFFF, xA5A50A0AA5A50A0A, x969639396969C6C6, 0x47)
LUT(x6C6CF2F229295D5D, xBFBFBFBFF6F6F9F9, x5555F0F0F5F55555, x79790202DCDC0808, 0x6E)
LUT(xA3A3505010101A1A, a2, xA2A2FFFF2222FFFF, x36369C9CC1C1D6D6, 0x94)
LUT(x7676C7C74F4FC7C7, a1, x2E2E6969A4A46363, xA3A3505010101A1A, 0xD9)
LUT(x4, a4, x6C6CF2F229295D5D, x7676C7C74F4FC7C7, 0xC6)
LUT (xA0A0A0A0FFFFFFFF, a1, a3, a6, 0xAB)
LUT (xFFFF00005555FFFF, a1, a5, a6, 0xB9)
LUT (xB3B320207777FFFF, a2, xA0A0A0A0FFFFFFFF, xFFFF00005555FFFF, 0xE8)
LUT (x50505A5A5A5A5050, a1, a3, xFFFF00005555FFFF, 0x34)
LUT (xA2A2FFFF2222FFFF, a1, a5, xB3B320207777FFFF, 0xCE)
LUT (x2E2E6969A4A46363, a2, x50505A5A5A5A5050, xA2A2FFFF2222FFFF, 0x29)
LUT (x3, a4, xB3B320207777FFFF, x2E2E6969A4A46363, 0xA6)
LUT (xA5A50A0AA5A50A0A, a1, a3, a5, 0x49)
LUT (x969639396969C6C6, a2, a6, xA5A50A0AA5A50A0A, 0x96)
LUT (x1B1B1B1B1B1B1B1B, a1, a2, a3, 0xCA)
LUT (xBFBFBFBFF6F6F9F9, a3, xA0A0A0A0FFFFFFFF, x969639396969C6C6, 0x7E)
LUT (x5B5BA4A4B8B81D1D, xFFFF00005555FFFF, x1B1B1B1B1B1B1B1B, xBFBFBFBFF6F6F9F9, 0x96)
LUT (x2, a4, x969639396969C6C6, x5B5BA4A4B8B81D1D, 0xCA)
LUT (x5555BBBBFFFF5555, a1, a2, xFFFF00005555FFFF, 0xE5)
LUT (x6D6D9C9C95956969, x50505A5A5A5A5050, xA2A2FFFF2222FFFF, x969639396969C6C6, 0x97)
LUT (x1A1A67676A6AB4B4, xA5A50A0AA5A50A0A, x5555BBBBFFFF5555, x6D6D9C9C95956969, 0x47)
LUT (xA0A0FFFFAAAA0000, a3, xFFFF00005555FFFF, xA5A50A0AA5A50A0A, 0x3B)
LUT (x36369C9CC1C1D6D6, x969639396969C6C6, x6D6D9C9C95956969, xA0A0FFFFAAAA0000, 0xD9)
LUT (x1, a4, x1A1A67676A6AB4B4, x36369C9CC1C1D6D6, 0xCA)
LUT (x5555F0F0F5F55555, a1, a3, xFFFF00005555FFFF, 0xB1)
LUT (x79790202DCDC0808, xA2A2FFFF2222FFFF, xA5A50A0AA5A50A0A, x969639396969C6C6, 0x47)
LUT (x6C6CF2F229295D5D, xBFBFBFBFF6F6F9F9, x5555F0F0F5F55555, x79790202DCDC0808, 0x6E)
LUT (xA3A3505010101A1A, a2, xA2A2FFFF2222FFFF, x36369C9CC1C1D6D6, 0x94)
LUT (x7676C7C74F4FC7C7, a1, x2E2E6969A4A46363, xA3A3505010101A1A, 0xD9)
LUT (x4, a4, x6C6CF2F229295D5D, x7676C7C74F4FC7C7, 0xC6)
*out1 ^= x1;
*out2 ^= x2;
@ -219,30 +219,30 @@ DECLSPEC void s5 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s6 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(x5050F5F55050F5F5, a1, a3, a5, 0xB2)
LUT(x6363C6C66363C6C6, a1, a2, x5050F5F55050F5F5, 0x66)
LUT(xAAAA5555AAAA5555, a1, a1, a5, 0xA9)
LUT(x3A3A65653A3A6565, a3, x6363C6C66363C6C6, xAAAA5555AAAA5555, 0xA9)
LUT(x5963A3C65963A3C6, a4, x6363C6C66363C6C6, x3A3A65653A3A6565, 0xC6)
LUT(xE7E76565E7E76565, a5, x6363C6C66363C6C6, x3A3A65653A3A6565, 0xAD)
LUT(x455D45DF455D45DF, a1, a4, xE7E76565E7E76565, 0xE4)
LUT(x4, a6, x5963A3C65963A3C6, x455D45DF455D45DF, 0x6C)
LUT(x1101220211012202, a2, xAAAA5555AAAA5555, x5963A3C65963A3C6, 0x20)
LUT(xF00F0FF0F00F0FF0, a3, a4, a5, 0x69)
LUT(x16E94A9716E94A97, xE7E76565E7E76565, x1101220211012202, xF00F0FF0F00F0FF0, 0x9E)
LUT(x2992922929929229, a1, a2, xF00F0FF0F00F0FF0, 0x49)
LUT(xAFAF9823AFAF9823, a5, x5050F5F55050F5F5, x2992922929929229, 0x93)
LUT(x3, a6, x16E94A9716E94A97, xAFAF9823AFAF9823, 0x6C)
LUT(x4801810248018102, a4, x5963A3C65963A3C6, x1101220211012202, 0xA4)
LUT(x5EE8FFFD5EE8FFFD, a5, x16E94A9716E94A97, x4801810248018102, 0x76)
LUT(xF0FF00FFF0FF00FF, a3, a4, a5, 0xCD)
LUT(x942D9A67942D9A67, x3A3A65653A3A6565, x5EE8FFFD5EE8FFFD, xF0FF00FFF0FF00FF, 0x86)
LUT(x1, a6, x5EE8FFFD5EE8FFFD, x942D9A67942D9A67, 0xA6)
LUT(x6A40D4ED6F4DD4EE, a2, x4, xAFAF9823AFAF9823, 0x2D)
LUT(x6CA89C7869A49C79, x1101220211012202, x16E94A9716E94A97, x6A40D4ED6F4DD4EE, 0x26)
LUT(xD6DE73F9D6DE73F9, a3, x6363C6C66363C6C6, x455D45DF455D45DF, 0x6B)
LUT(x925E63E1965A63E1, x3A3A65653A3A6565, x6CA89C7869A49C79, xD6DE73F9D6DE73F9, 0xA2)
LUT(x2, a6, x6CA89C7869A49C79, x925E63E1965A63E1, 0xCA)
LUT (x5050F5F55050F5F5, a1, a3, a5, 0xB2)
LUT (x6363C6C66363C6C6, a1, a2, x5050F5F55050F5F5, 0x66)
LUT (xAAAA5555AAAA5555, a1, a1, a5, 0xA9)
LUT (x3A3A65653A3A6565, a3, x6363C6C66363C6C6, xAAAA5555AAAA5555, 0xA9)
LUT (x5963A3C65963A3C6, a4, x6363C6C66363C6C6, x3A3A65653A3A6565, 0xC6)
LUT (xE7E76565E7E76565, a5, x6363C6C66363C6C6, x3A3A65653A3A6565, 0xAD)
LUT (x455D45DF455D45DF, a1, a4, xE7E76565E7E76565, 0xE4)
LUT (x4, a6, x5963A3C65963A3C6, x455D45DF455D45DF, 0x6C)
LUT (x1101220211012202, a2, xAAAA5555AAAA5555, x5963A3C65963A3C6, 0x20)
LUT (xF00F0FF0F00F0FF0, a3, a4, a5, 0x69)
LUT (x16E94A9716E94A97, xE7E76565E7E76565, x1101220211012202, xF00F0FF0F00F0FF0, 0x9E)
LUT (x2992922929929229, a1, a2, xF00F0FF0F00F0FF0, 0x49)
LUT (xAFAF9823AFAF9823, a5, x5050F5F55050F5F5, x2992922929929229, 0x93)
LUT (x3, a6, x16E94A9716E94A97, xAFAF9823AFAF9823, 0x6C)
LUT (x4801810248018102, a4, x5963A3C65963A3C6, x1101220211012202, 0xA4)
LUT (x5EE8FFFD5EE8FFFD, a5, x16E94A9716E94A97, x4801810248018102, 0x76)
LUT (xF0FF00FFF0FF00FF, a3, a4, a5, 0xCD)
LUT (x942D9A67942D9A67, x3A3A65653A3A6565, x5EE8FFFD5EE8FFFD, xF0FF00FFF0FF00FF, 0x86)
LUT (x1, a6, x5EE8FFFD5EE8FFFD, x942D9A67942D9A67, 0xA6)
LUT (x6A40D4ED6F4DD4EE, a2, x4, xAFAF9823AFAF9823, 0x2D)
LUT (x6CA89C7869A49C79, x1101220211012202, x16E94A9716E94A97, x6A40D4ED6F4DD4EE, 0x26)
LUT (xD6DE73F9D6DE73F9, a3, x6363C6C66363C6C6, x455D45DF455D45DF, 0x6B)
LUT (x925E63E1965A63E1, x3A3A65653A3A6565, x6CA89C7869A49C79, xD6DE73F9D6DE73F9, 0xA2)
LUT (x2, a6, x6CA89C7869A49C79, x925E63E1965A63E1, 0xCA)
*out1 ^= x1;
*out2 ^= x2;
@ -252,30 +252,30 @@ DECLSPEC void s6 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s7 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(x88AA88AA88AA88AA, a1, a2, a4, 0x0B)
LUT(xAAAAFF00AAAAFF00, a1, a4, a5, 0x27)
LUT(xADAFF8A5ADAFF8A5, a3, x88AA88AA88AA88AA, xAAAAFF00AAAAFF00, 0x9E)
LUT(x0A0AF5F50A0AF5F5, a1, a3, a5, 0xA6)
LUT(x6B69C5DC6B69C5DC, a2, xADAFF8A5ADAFF8A5, x0A0AF5F50A0AF5F5, 0x6B)
LUT(x1C69B2DC1C69B2DC, a4, x88AA88AA88AA88AA, x6B69C5DC6B69C5DC, 0xA9)
LUT(x1, a6, xADAFF8A5ADAFF8A5, x1C69B2DC1C69B2DC, 0x6A)
LUT(x9C9C9C9C9C9C9C9C, a1, a2, a3, 0x63)
LUT(xE6E63BFDE6E63BFD, a2, xAAAAFF00AAAAFF00, x0A0AF5F50A0AF5F5, 0xE7)
LUT(x6385639E6385639E, a4, x9C9C9C9C9C9C9C9C, xE6E63BFDE6E63BFD, 0x93)
LUT(x5959C4CE5959C4CE, a2, x6B69C5DC6B69C5DC, xE6E63BFDE6E63BFD, 0x5D)
LUT(x5B53F53B5B53F53B, a4, x0A0AF5F50A0AF5F5, x5959C4CE5959C4CE, 0x6E)
LUT(x3, a6, x6385639E6385639E, x5B53F53B5B53F53B, 0xC6)
LUT(xFAF505FAFAF505FA, a3, a4, x0A0AF5F50A0AF5F5, 0x6D)
LUT(x6A65956A6A65956A, a3, x9C9C9C9C9C9C9C9C, xFAF505FAFAF505FA, 0xA6)
LUT(x8888CCCC8888CCCC, a1, a2, a5, 0x23)
LUT(x94E97A9494E97A94, x1C69B2DC1C69B2DC, x6A65956A6A65956A, x8888CCCC8888CCCC, 0x72)
LUT(x4, a6, x6A65956A6A65956A, x94E97A9494E97A94, 0xAC)
LUT(xA050A050A050A050, a1, a3, a4, 0x21)
LUT(xC1B87A2BC1B87A2B, xAAAAFF00AAAAFF00, x5B53F53B5B53F53B, x94E97A9494E97A94, 0xA4)
LUT(xE96016B7E96016B7, x8888CCCC8888CCCC, xA050A050A050A050, xC1B87A2BC1B87A2B, 0x96)
LUT(xE3CF1FD5E3CF1FD5, x88AA88AA88AA88AA, x6A65956A6A65956A, xE96016B7E96016B7, 0x3E)
LUT(x6776675B6776675B, xADAFF8A5ADAFF8A5, x94E97A9494E97A94, xE3CF1FD5E3CF1FD5, 0x6B)
LUT(x2, a6, xE96016B7E96016B7, x6776675B6776675B, 0xC6)
LUT (x88AA88AA88AA88AA, a1, a2, a4, 0x0B)
LUT (xAAAAFF00AAAAFF00, a1, a4, a5, 0x27)
LUT (xADAFF8A5ADAFF8A5, a3, x88AA88AA88AA88AA, xAAAAFF00AAAAFF00, 0x9E)
LUT (x0A0AF5F50A0AF5F5, a1, a3, a5, 0xA6)
LUT (x6B69C5DC6B69C5DC, a2, xADAFF8A5ADAFF8A5, x0A0AF5F50A0AF5F5, 0x6B)
LUT (x1C69B2DC1C69B2DC, a4, x88AA88AA88AA88AA, x6B69C5DC6B69C5DC, 0xA9)
LUT (x1, a6, xADAFF8A5ADAFF8A5, x1C69B2DC1C69B2DC, 0x6A)
LUT (x9C9C9C9C9C9C9C9C, a1, a2, a3, 0x63)
LUT (xE6E63BFDE6E63BFD, a2, xAAAAFF00AAAAFF00, x0A0AF5F50A0AF5F5, 0xE7)
LUT (x6385639E6385639E, a4, x9C9C9C9C9C9C9C9C, xE6E63BFDE6E63BFD, 0x93)
LUT (x5959C4CE5959C4CE, a2, x6B69C5DC6B69C5DC, xE6E63BFDE6E63BFD, 0x5D)
LUT (x5B53F53B5B53F53B, a4, x0A0AF5F50A0AF5F5, x5959C4CE5959C4CE, 0x6E)
LUT (x3, a6, x6385639E6385639E, x5B53F53B5B53F53B, 0xC6)
LUT (xFAF505FAFAF505FA, a3, a4, x0A0AF5F50A0AF5F5, 0x6D)
LUT (x6A65956A6A65956A, a3, x9C9C9C9C9C9C9C9C, xFAF505FAFAF505FA, 0xA6)
LUT (x8888CCCC8888CCCC, a1, a2, a5, 0x23)
LUT (x94E97A9494E97A94, x1C69B2DC1C69B2DC, x6A65956A6A65956A, x8888CCCC8888CCCC, 0x72)
LUT (x4, a6, x6A65956A6A65956A, x94E97A9494E97A94, 0xAC)
LUT (xA050A050A050A050, a1, a3, a4, 0x21)
LUT (xC1B87A2BC1B87A2B, xAAAAFF00AAAAFF00, x5B53F53B5B53F53B, x94E97A9494E97A94, 0xA4)
LUT (xE96016B7E96016B7, x8888CCCC8888CCCC, xA050A050A050A050, xC1B87A2BC1B87A2B, 0x96)
LUT (xE3CF1FD5E3CF1FD5, x88AA88AA88AA88AA, x6A65956A6A65956A, xE96016B7E96016B7, 0x3E)
LUT (x6776675B6776675B, xADAFF8A5ADAFF8A5, x94E97A9494E97A94, xE3CF1FD5E3CF1FD5, 0x6B)
LUT (x2, a6, xE96016B7E96016B7, x6776675B6776675B, 0xC6)
*out1 ^= x1;
*out2 ^= x2;
@ -285,29 +285,29 @@ DECLSPEC void s7 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
DECLSPEC void s8 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u32 a5, const u32 a6, u32 *out1, u32 *out2, u32 *out3, u32 *out4)
{
LUT(xEEEE3333EEEE3333, a1, a2, a5, 0x9D)
LUT(xBBBBBBBBBBBBBBBB, a1, a1, a2, 0x83)
LUT(xDDDDAAAADDDDAAAA, a1, a2, a5, 0x5B)
LUT(x29295A5A29295A5A, a3, xBBBBBBBBBBBBBBBB, xDDDDAAAADDDDAAAA, 0x85)
LUT(xC729695AC729695A, a4, xEEEE3333EEEE3333, x29295A5A29295A5A, 0xA6)
LUT(x3BF77B7B3BF77B7B, a2, a5, xC729695AC729695A, 0xF9)
LUT(x2900FF002900FF00, a4, a5, x29295A5A29295A5A, 0x0E)
LUT(x56B3803F56B3803F, xBBBBBBBBBBBBBBBB, x3BF77B7B3BF77B7B, x2900FF002900FF00, 0x61)
LUT(x4, a6, xC729695AC729695A, x56B3803F56B3803F, 0x6C)
LUT(xFBFBFBFBFBFBFBFB, a1, a2, a3, 0xDF)
LUT(x3012B7B73012B7B7, a2, a5, xC729695AC729695A, 0xD4)
LUT(x34E9B34C34E9B34C, a4, xFBFBFBFBFBFBFBFB, x3012B7B73012B7B7, 0x69)
LUT(xBFEAEBBEBFEAEBBE, a1, x29295A5A29295A5A, x34E9B34C34E9B34C, 0x6F)
LUT(xFFAEAFFEFFAEAFFE, a3, xBBBBBBBBBBBBBBBB, xBFEAEBBEBFEAEBBE, 0xB9)
LUT(x2, a6, x34E9B34C34E9B34C, xFFAEAFFEFFAEAFFE, 0xC6)
LUT(xCFDE88BBCFDE88BB, a2, xDDDDAAAADDDDAAAA, x34E9B34C34E9B34C, 0x5C)
LUT(x3055574530555745, a1, xC729695AC729695A, xCFDE88BBCFDE88BB, 0x71)
LUT(x99DDEEEE99DDEEEE, a4, xBBBBBBBBBBBBBBBB, xDDDDAAAADDDDAAAA, 0xB9)
LUT(x693CD926693CD926, x3BF77B7B3BF77B7B, x34E9B34C34E9B34C, x99DDEEEE99DDEEEE, 0x69)
LUT(x3, a6, x3055574530555745, x693CD926693CD926, 0x6A)
LUT(x9955EE559955EE55, a1, a4, x99DDEEEE99DDEEEE, 0xE2)
LUT(x9D48FA949D48FA94, x3BF77B7B3BF77B7B, xBFEAEBBEBFEAEBBE, x9955EE559955EE55, 0x9C)
LUT(x1, a6, xC729695AC729695A, x9D48FA949D48FA94, 0x39)
LUT (xEEEE3333EEEE3333, a1, a2, a5, 0x9D)
LUT (xBBBBBBBBBBBBBBBB, a1, a1, a2, 0x83)
LUT (xDDDDAAAADDDDAAAA, a1, a2, a5, 0x5B)
LUT (x29295A5A29295A5A, a3, xBBBBBBBBBBBBBBBB, xDDDDAAAADDDDAAAA, 0x85)
LUT (xC729695AC729695A, a4, xEEEE3333EEEE3333, x29295A5A29295A5A, 0xA6)
LUT (x3BF77B7B3BF77B7B, a2, a5, xC729695AC729695A, 0xF9)
LUT (x2900FF002900FF00, a4, a5, x29295A5A29295A5A, 0x0E)
LUT (x56B3803F56B3803F, xBBBBBBBBBBBBBBBB, x3BF77B7B3BF77B7B, x2900FF002900FF00, 0x61)
LUT (x4, a6, xC729695AC729695A, x56B3803F56B3803F, 0x6C)
LUT (xFBFBFBFBFBFBFBFB, a1, a2, a3, 0xDF)
LUT (x3012B7B73012B7B7, a2, a5, xC729695AC729695A, 0xD4)
LUT (x34E9B34C34E9B34C, a4, xFBFBFBFBFBFBFBFB, x3012B7B73012B7B7, 0x69)
LUT (xBFEAEBBEBFEAEBBE, a1, x29295A5A29295A5A, x34E9B34C34E9B34C, 0x6F)
LUT (xFFAEAFFEFFAEAFFE, a3, xBBBBBBBBBBBBBBBB, xBFEAEBBEBFEAEBBE, 0xB9)
LUT (x2, a6, x34E9B34C34E9B34C, xFFAEAFFEFFAEAFFE, 0xC6)
LUT (xCFDE88BBCFDE88BB, a2, xDDDDAAAADDDDAAAA, x34E9B34C34E9B34C, 0x5C)
LUT (x3055574530555745, a1, xC729695AC729695A, xCFDE88BBCFDE88BB, 0x71)
LUT (x99DDEEEE99DDEEEE, a4, xBBBBBBBBBBBBBBBB, xDDDDAAAADDDDAAAA, 0xB9)
LUT (x693CD926693CD926, x3BF77B7B3BF77B7B, x34E9B34C34E9B34C, x99DDEEEE99DDEEEE, 0x69)
LUT (x3, a6, x3055574530555745, x693CD926693CD926, 0x6A)
LUT (x9955EE559955EE55, a1, a4, x99DDEEEE99DDEEEE, 0xE2)
LUT (x9D48FA949D48FA94, x3BF77B7B3BF77B7B, xBFEAEBBEBFEAEBBE, x9955EE559955EE55, 0x9C)
LUT (x1, a6, xC729695AC729695A, x9D48FA949D48FA94, 0x39)
*out1 ^= x1;
*out2 ^= x2;
@ -1480,38 +1480,38 @@ DECLSPEC void s8 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
#define SWAP(a, b) { u32 tmp=*a;*a=*b;*b=tmp; }
#define DATASWAP \
SWAP(D00, D32); \
SWAP(D01, D33); \
SWAP(D02, D34); \
SWAP(D03, D35); \
SWAP(D04, D36); \
SWAP(D05, D37); \
SWAP(D06, D38); \
SWAP(D07, D39); \
SWAP(D08, D40); \
SWAP(D09, D41); \
SWAP(D10, D42); \
SWAP(D11, D43); \
SWAP(D12, D44); \
SWAP(D13, D45); \
SWAP(D14, D46); \
SWAP(D15, D47); \
SWAP(D16, D48); \
SWAP(D17, D49); \
SWAP(D18, D50); \
SWAP(D19, D51); \
SWAP(D20, D52); \
SWAP(D21, D53); \
SWAP(D22, D54); \
SWAP(D23, D55); \
SWAP(D24, D56); \
SWAP(D25, D57); \
SWAP(D26, D58); \
SWAP(D27, D59); \
SWAP(D28, D60); \
SWAP(D29, D61); \
SWAP(D30, D62); \
SWAP(D31, D63);
SWAP (D00, D32); \
SWAP (D01, D33); \
SWAP (D02, D34); \
SWAP (D03, D35); \
SWAP (D04, D36); \
SWAP (D05, D37); \
SWAP (D06, D38); \
SWAP (D07, D39); \
SWAP (D08, D40); \
SWAP (D09, D41); \
SWAP (D10, D42); \
SWAP (D11, D43); \
SWAP (D12, D44); \
SWAP (D13, D45); \
SWAP (D14, D46); \
SWAP (D15, D47); \
SWAP (D16, D48); \
SWAP (D17, D49); \
SWAP (D18, D50); \
SWAP (D19, D51); \
SWAP (D20, D52); \
SWAP (D21, D53); \
SWAP (D22, D54); \
SWAP (D23, D55); \
SWAP (D24, D56); \
SWAP (D25, D57); \
SWAP (D26, D58); \
SWAP (D27, D59); \
SWAP (D28, D60); \
SWAP (D29, D61); \
SWAP (D30, D62); \
SWAP (D31, D63);
#define KEYSET00 { k00 = K08; k01 = K44; k02 = K29; k03 = K52; k04 = K42; k05 = K14; k06 = K28; k07 = K49; k08 = K01; k09 = K07; k10 = K16; k11 = K36; k12 = K02; k13 = K30; k14 = K22; k15 = K21; k16 = K38; k17 = K50; k18 = K51; k19 = K00; k20 = K31; k21 = K23; k22 = K15; k23 = K35; k24 = K19; k25 = K24; k26 = K34; k27 = K47; k28 = K32; k29 = K03; k30 = K41; k31 = K26; k32 = K04; k33 = K46; k34 = K20; k35 = K25; k36 = K53; k37 = K18; k38 = K33; k39 = K55; k40 = K13; k41 = K17; k42 = K39; k43 = K12; k44 = K11; k45 = K54; k46 = K48; k47 = K27; }
#define KEYSET10 { k00 = K49; k01 = K28; k02 = K45; k03 = K36; k04 = K01; k05 = K30; k06 = K44; k07 = K08; k08 = K42; k09 = K23; k10 = K00; k11 = K52; k12 = K43; k13 = K14; k14 = K38; k15 = K37; k16 = K22; k17 = K09; k18 = K35; k19 = K16; k20 = K15; k21 = K07; k22 = K31; k23 = K51; k24 = K03; k25 = K40; k26 = K46; k27 = K04; k28 = K20; k29 = K19; k30 = K53; k31 = K10; k32 = K47; k33 = K34; k34 = K32; k35 = K13; k36 = K41; k37 = K06; k38 = K17; k39 = K12; k40 = K25; k41 = K33; k42 = K27; k43 = K55; k44 = K54; k45 = K11; k46 = K05; k47 = K39; }

View File

@ -1479,38 +1479,38 @@ DECLSPEC void s8 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
#define SWAP(a, b) { u32 tmp=*a;*a=*b;*b=tmp; }
#define DATASWAP \
SWAP(D00, D32); \
SWAP(D01, D33); \
SWAP(D02, D34); \
SWAP(D03, D35); \
SWAP(D04, D36); \
SWAP(D05, D37); \
SWAP(D06, D38); \
SWAP(D07, D39); \
SWAP(D08, D40); \
SWAP(D09, D41); \
SWAP(D10, D42); \
SWAP(D11, D43); \
SWAP(D12, D44); \
SWAP(D13, D45); \
SWAP(D14, D46); \
SWAP(D15, D47); \
SWAP(D16, D48); \
SWAP(D17, D49); \
SWAP(D18, D50); \
SWAP(D19, D51); \
SWAP(D20, D52); \
SWAP(D21, D53); \
SWAP(D22, D54); \
SWAP(D23, D55); \
SWAP(D24, D56); \
SWAP(D25, D57); \
SWAP(D26, D58); \
SWAP(D27, D59); \
SWAP(D28, D60); \
SWAP(D29, D61); \
SWAP(D30, D62); \
SWAP(D31, D63);
SWAP (D00, D32); \
SWAP (D01, D33); \
SWAP (D02, D34); \
SWAP (D03, D35); \
SWAP (D04, D36); \
SWAP (D05, D37); \
SWAP (D06, D38); \
SWAP (D07, D39); \
SWAP (D08, D40); \
SWAP (D09, D41); \
SWAP (D10, D42); \
SWAP (D11, D43); \
SWAP (D12, D44); \
SWAP (D13, D45); \
SWAP (D14, D46); \
SWAP (D15, D47); \
SWAP (D16, D48); \
SWAP (D17, D49); \
SWAP (D18, D50); \
SWAP (D19, D51); \
SWAP (D20, D52); \
SWAP (D21, D53); \
SWAP (D22, D54); \
SWAP (D23, D55); \
SWAP (D24, D56); \
SWAP (D25, D57); \
SWAP (D26, D58); \
SWAP (D27, D59); \
SWAP (D28, D60); \
SWAP (D29, D61); \
SWAP (D30, D62); \
SWAP (D31, D63);
#define KEYSET00 { k00 = K08; k01 = K44; k02 = K29; k03 = K52; k04 = K42; k05 = K14; k06 = K28; k07 = K49; k08 = K01; k09 = K07; k10 = K16; k11 = K36; k12 = K02; k13 = K30; k14 = K22; k15 = K21; k16 = K38; k17 = K50; k18 = K51; k19 = K00; k20 = K31; k21 = K23; k22 = K15; k23 = K35; k24 = K19; k25 = K24; k26 = K34; k27 = K47; k28 = K32; k29 = K03; k30 = K41; k31 = K26; k32 = K04; k33 = K46; k34 = K20; k35 = K25; k36 = K53; k37 = K18; k38 = K33; k39 = K55; k40 = K13; k41 = K17; k42 = K39; k43 = K12; k44 = K11; k45 = K54; k46 = K48; k47 = K27; }
#define KEYSET10 { k00 = K49; k01 = K28; k02 = K45; k03 = K36; k04 = K01; k05 = K30; k06 = K44; k07 = K08; k08 = K42; k09 = K23; k10 = K00; k11 = K52; k12 = K43; k13 = K14; k14 = K38; k15 = K37; k16 = K22; k17 = K09; k18 = K35; k19 = K16; k20 = K15; k21 = K07; k22 = K31; k23 = K51; k24 = K03; k25 = K40; k26 = K46; k27 = K04; k28 = K20; k29 = K19; k30 = K53; k31 = K10; k32 = K47; k33 = K34; k34 = K32; k35 = K13; k36 = K41; k37 = K06; k38 = K17; k39 = K12; k40 = K25; k41 = K33; k42 = K27; k43 = K55; k44 = K54; k45 = K11; k46 = K05; k47 = K39; }

View File

@ -1479,38 +1479,38 @@ DECLSPEC void s8 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const
#define SWAP(a, b) { u32 tmp=*a;*a=*b;*b=tmp; }
#define DATASWAP \
SWAP(D00, D32); \
SWAP(D01, D33); \
SWAP(D02, D34); \
SWAP(D03, D35); \
SWAP(D04, D36); \
SWAP(D05, D37); \
SWAP(D06, D38); \
SWAP(D07, D39); \
SWAP(D08, D40); \
SWAP(D09, D41); \
SWAP(D10, D42); \
SWAP(D11, D43); \
SWAP(D12, D44); \
SWAP(D13, D45); \
SWAP(D14, D46); \
SWAP(D15, D47); \
SWAP(D16, D48); \
SWAP(D17, D49); \
SWAP(D18, D50); \
SWAP(D19, D51); \
SWAP(D20, D52); \
SWAP(D21, D53); \
SWAP(D22, D54); \
SWAP(D23, D55); \
SWAP(D24, D56); \
SWAP(D25, D57); \
SWAP(D26, D58); \
SWAP(D27, D59); \
SWAP(D28, D60); \
SWAP(D29, D61); \
SWAP(D30, D62); \
SWAP(D31, D63);
SWAP (D00, D32); \
SWAP (D01, D33); \
SWAP (D02, D34); \
SWAP (D03, D35); \
SWAP (D04, D36); \
SWAP (D05, D37); \
SWAP (D06, D38); \
SWAP (D07, D39); \
SWAP (D08, D40); \
SWAP (D09, D41); \
SWAP (D10, D42); \
SWAP (D11, D43); \
SWAP (D12, D44); \
SWAP (D13, D45); \
SWAP (D14, D46); \
SWAP (D15, D47); \
SWAP (D16, D48); \
SWAP (D17, D49); \
SWAP (D18, D50); \
SWAP (D19, D51); \
SWAP (D20, D52); \
SWAP (D21, D53); \
SWAP (D22, D54); \
SWAP (D23, D55); \
SWAP (D24, D56); \
SWAP (D25, D57); \
SWAP (D26, D58); \
SWAP (D27, D59); \
SWAP (D28, D60); \
SWAP (D29, D61); \
SWAP (D30, D62); \
SWAP (D31, D63);
#define KEYSET00 { k00 = K08; k01 = K44; k02 = K29; k03 = K52; k04 = K42; k05 = K14; k06 = K28; k07 = K49; k08 = K01; k09 = K07; k10 = K16; k11 = K36; k12 = K02; k13 = K30; k14 = K22; k15 = K21; k16 = K38; k17 = K50; k18 = K51; k19 = K00; k20 = K31; k21 = K23; k22 = K15; k23 = K35; k24 = K19; k25 = K24; k26 = K34; k27 = K47; k28 = K32; k29 = K03; k30 = K41; k31 = K26; k32 = K04; k33 = K46; k34 = K20; k35 = K25; k36 = K53; k37 = K18; k38 = K33; k39 = K55; k40 = K13; k41 = K17; k42 = K39; k43 = K12; k44 = K11; k45 = K54; k46 = K48; k47 = K27; }
#define KEYSET10 { k00 = K49; k01 = K28; k02 = K45; k03 = K36; k04 = K01; k05 = K30; k06 = K44; k07 = K08; k08 = K42; k09 = K23; k10 = K00; k11 = K52; k12 = K43; k13 = K14; k14 = K38; k15 = K37; k16 = K22; k17 = K09; k18 = K35; k19 = K16; k20 = K15; k21 = K07; k22 = K31; k23 = K51; k24 = K03; k25 = K40; k26 = K46; k27 = K04; k28 = K20; k29 = K19; k30 = K53; k31 = K10; k32 = K47; k33 = K34; k34 = K32; k35 = K13; k36 = K41; k37 = K06; k38 = K17; k39 = K12; k40 = K25; k41 = K33; k42 = K27; k43 = K55; k44 = K54; k45 = K11; k46 = K05; k47 = K39; }

View File

@ -32,13 +32,13 @@ typedef struct chacha20
#define QR(a, b, c, d) \
do { \
x[a] = x[a] + x[b]; \
x[d] = hc_rotl32(x[d] ^ x[a], 16); \
x[c] = x[c] + x[d]; \
x[b] = hc_rotl32(x[b] ^ x[c], 12); \
x[a] = x[a] + x[b]; \
x[d] = hc_rotl32(x[d] ^ x[a], 8); \
x[c] = x[c] + x[d]; \
x[b] = hc_rotl32(x[b] ^ x[c], 7); \
x[d] = hc_rotl32 (x[d] ^ x[a], 16); \
x[c] = x[c] + x[ d]; \
x[b] = hc_rotl32 (x[b] ^ x[c], 12); \
x[a] = x[a] + x[ b]; \
x[d] = hc_rotl32 (x[d] ^ x[a], 8); \
x[c] = x[c] + x[ d]; \
x[b] = hc_rotl32 (x[b] ^ x[c], 7); \
} while (0);
DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *position, const u32 offset, const u32 *iv, const u32 *plain, u32x *digest)
@ -93,16 +93,16 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
for (u8 i = 0; i < 10; i++)
{
/* Column round */
QR(0, 4, 8, 12);
QR(1, 5, 9, 13);
QR(2, 6, 10, 14);
QR(3, 7, 11, 15);
QR (0, 4, 8, 12);
QR (1, 5, 9, 13);
QR (2, 6, 10, 14);
QR (3, 7, 11, 15);
/* Diagonal round */
QR(0, 5, 10, 15);
QR(1, 6, 11, 12);
QR(2, 7, 8, 13);
QR(3, 4, 9, 14);
QR (0, 5, 10, 15);
QR (1, 6, 11, 12);
QR (2, 7, 8, 13);
QR (3, 4, 9, 14);
}
x[ 0] += ctx[ 0];
@ -183,16 +183,16 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
for (u8 i = 0; i < 10; i++)
{
/* Column round */
QR(16, 20, 24, 28);
QR(17, 21, 25, 29);
QR(18, 22, 26, 30);
QR(19, 23, 27, 31);
QR (16, 20, 24, 28);
QR (17, 21, 25, 29);
QR (18, 22, 26, 30);
QR (19, 23, 27, 31);
/* Diagonal round */
QR(16, 21, 26, 31);
QR(17, 22, 27, 28);
QR(18, 23, 24, 29);
QR(19, 20, 25, 30);
QR (16, 21, 26, 31);
QR (17, 22, 27, 28);
QR (18, 23, 24, 29);
QR (19, 20, 25, 30);
}
x[16] += ctx[ 0];
@ -304,7 +304,7 @@ KERNEL_FQ void m15400_m04 (KERN_ATTR_RULES_ESALT (chacha20_t))
const u32x r2 = digest[2];
const u32x r3 = digest[3];
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -394,7 +394,7 @@ KERNEL_FQ void m15400_s04 (KERN_ATTR_RULES_ESALT (chacha20_t))
const u32x r2 = digest[2];
const u32x r3 = digest[3];
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -30,13 +30,13 @@ typedef struct chacha20
#define QR(a, b, c, d) \
do { \
x[a] = x[a] + x[b]; \
x[d] = hc_rotl32(x[d] ^ x[a], 16); \
x[c] = x[c] + x[d]; \
x[b] = hc_rotl32(x[b] ^ x[c], 12); \
x[a] = x[a] + x[b]; \
x[d] = hc_rotl32(x[d] ^ x[a], 8); \
x[c] = x[c] + x[d]; \
x[b] = hc_rotl32(x[b] ^ x[c], 7); \
x[d] = hc_rotl32 (x[d] ^ x[a], 16); \
x[c] = x[c] + x[ d]; \
x[b] = hc_rotl32 (x[b] ^ x[c], 12); \
x[a] = x[a] + x[ b]; \
x[d] = hc_rotl32 (x[d] ^ x[a], 8); \
x[c] = x[c] + x[ d]; \
x[b] = hc_rotl32 (x[b] ^ x[c], 7); \
} while (0);
DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *position, const u32 offset, const u32 *iv, const u32 *plain, u32x *digest)
@ -91,16 +91,16 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
for (u8 i = 0; i < 10; i++)
{
/* Column round */
QR(0, 4, 8, 12);
QR(1, 5, 9, 13);
QR(2, 6, 10, 14);
QR(3, 7, 11, 15);
QR (0, 4, 8, 12);
QR (1, 5, 9, 13);
QR (2, 6, 10, 14);
QR (3, 7, 11, 15);
/* Diagonal round */
QR(0, 5, 10, 15);
QR(1, 6, 11, 12);
QR(2, 7, 8, 13);
QR(3, 4, 9, 14);
QR (0, 5, 10, 15);
QR (1, 6, 11, 12);
QR (2, 7, 8, 13);
QR (3, 4, 9, 14);
}
x[ 0] += ctx[ 0];
@ -181,16 +181,16 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
for (u8 i = 0; i < 10; i++)
{
/* Column round */
QR(16, 20, 24, 28);
QR(17, 21, 25, 29);
QR(18, 22, 26, 30);
QR(19, 23, 27, 31);
QR (16, 20, 24, 28);
QR (17, 21, 25, 29);
QR (18, 22, 26, 30);
QR (19, 23, 27, 31);
/* Diagonal round */
QR(16, 21, 26, 31);
QR(17, 22, 27, 28);
QR(18, 23, 24, 29);
QR(19, 20, 25, 30);
QR (16, 21, 26, 31);
QR (17, 22, 27, 28);
QR (18, 23, 24, 29);
QR (19, 20, 25, 30);
}
x[16] += ctx[ 0];
@ -351,7 +351,7 @@ KERNEL_FQ void m15400_m04 (KERN_ATTR_ESALT (chacha20_t))
const u32x r2 = digest[2];
const u32x r3 = digest[3];
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -493,7 +493,7 @@ KERNEL_FQ void m15400_s04 (KERN_ATTR_ESALT (chacha20_t))
const u32x r2 = digest[2];
const u32x r3 = digest[3];
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -30,13 +30,13 @@ typedef struct chacha20
#define QR(a, b, c, d) \
do { \
x[a] = x[a] + x[b]; \
x[d] = hc_rotl32(x[d] ^ x[a], 16); \
x[d] = hc_rotl32 (x[d] ^ x[a], 16); \
x[c] = x[c] + x[d]; \
x[b] = hc_rotl32(x[b] ^ x[c], 12); \
x[b] = hc_rotl32 (x[b] ^ x[c], 12); \
x[a] = x[a] + x[b]; \
x[d] = hc_rotl32(x[d] ^ x[a], 8); \
x[d] = hc_rotl32 (x[d] ^ x[a], 8); \
x[c] = x[c] + x[d]; \
x[b] = hc_rotl32(x[b] ^ x[c], 7); \
x[b] = hc_rotl32 (x[b] ^ x[c], 7); \
} while (0);
DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *position, const u32 offset, const u32 *iv, const u32 *plain, u32x *digest)
@ -91,16 +91,16 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
for (u8 i = 0; i < 10; i++)
{
/* Column round */
QR(0, 4, 8, 12);
QR(1, 5, 9, 13);
QR(2, 6, 10, 14);
QR(3, 7, 11, 15);
QR (0, 4, 8, 12);
QR (1, 5, 9, 13);
QR (2, 6, 10, 14);
QR (3, 7, 11, 15);
/* Diagonal round */
QR(0, 5, 10, 15);
QR(1, 6, 11, 12);
QR(2, 7, 8, 13);
QR(3, 4, 9, 14);
QR (0, 5, 10, 15);
QR (1, 6, 11, 12);
QR (2, 7, 8, 13);
QR (3, 4, 9, 14);
}
x[ 0] += ctx[ 0];
@ -181,16 +181,16 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
for (u8 i = 0; i < 10; i++)
{
/* Column round */
QR(16, 20, 24, 28);
QR(17, 21, 25, 29);
QR(18, 22, 26, 30);
QR(19, 23, 27, 31);
QR (16, 20, 24, 28);
QR (17, 21, 25, 29);
QR (18, 22, 26, 30);
QR (19, 23, 27, 31);
/* Diagonal round */
QR(16, 21, 26, 31);
QR(17, 22, 27, 28);
QR(18, 23, 24, 29);
QR(19, 20, 25, 30);
QR (16, 21, 26, 31);
QR (17, 22, 27, 28);
QR (18, 23, 24, 29);
QR (19, 20, 25, 30);
}
x[16] += ctx[ 0];
@ -320,7 +320,7 @@ KERNEL_FQ void m15400_m16 (KERN_ATTR_VECTOR_ESALT (chacha20_t))
const u32x r2 = digest[2];
const u32x r3 = digest[3];
COMPARE_M_SIMD(r0, r1, r2, r3);
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
@ -420,6 +420,6 @@ KERNEL_FQ void m15400_s16 (KERN_ATTR_VECTOR_ESALT (chacha20_t))
const u32x r2 = digest[2];
const u32x r3 = digest[3];
COMPARE_S_SIMD(r0, r1, r2, r3);
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -80,7 +80,6 @@ DECLSPEC void m17400m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u64x a43 = 0;
u64x a44 = 0;
#define Rho_Pi(ad,r) \
bc0 = ad; \
ad = hc_rotl64 (t, r); \

View File

@ -80,7 +80,6 @@ DECLSPEC void m17600m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u64x a43 = 0;
u64x a44 = 0;
#define Rho_Pi(ad,r) \
bc0 = ad; \
ad = hc_rotl64 (t, r); \

View File

@ -116,21 +116,21 @@ KERNEL_FQ void m18500_mxx (KERN_ATTR_RULES ())
sha1_init (&ctx2);
ctx2.w0[0] = hc_swap32(uint_to_hex_lower8 ((e >> 0) & 255) << 0
ctx2.w0[0] = hc_swap32 (uint_to_hex_lower8 ((e >> 0) & 255) << 0
| uint_to_hex_lower8 ((e >> 8) & 255) << 16);
ctx2.w0[1] = hc_swap32(uint_to_hex_lower8 ((e >> 16) & 255) << 0
ctx2.w0[1] = hc_swap32 (uint_to_hex_lower8 ((e >> 16) & 255) << 0
| uint_to_hex_lower8 ((e >> 24) & 255) << 16);
ctx2.w0[2] = hc_swap32(uint_to_hex_lower8 ((f >> 0) & 255) << 0
ctx2.w0[2] = hc_swap32 (uint_to_hex_lower8 ((f >> 0) & 255) << 0
| uint_to_hex_lower8 ((f >> 8) & 255) << 16);
ctx2.w0[3] = hc_swap32(uint_to_hex_lower8 ((f >> 16) & 255) << 0
ctx2.w0[3] = hc_swap32 (uint_to_hex_lower8 ((f >> 16) & 255) << 0
| uint_to_hex_lower8 ((f >> 24) & 255) << 16);
ctx2.w1[0] = hc_swap32(uint_to_hex_lower8 ((g >> 0) & 255) << 0
ctx2.w1[0] = hc_swap32 (uint_to_hex_lower8 ((g >> 0) & 255) << 0
| uint_to_hex_lower8 ((g >> 8) & 255) << 16);
ctx2.w1[1] = hc_swap32(uint_to_hex_lower8 ((g >> 16) & 255) << 0
ctx2.w1[1] = hc_swap32 (uint_to_hex_lower8 ((g >> 16) & 255) << 0
| uint_to_hex_lower8 ((g >> 24) & 255) << 16);
ctx2.w1[2] = hc_swap32(uint_to_hex_lower8 ((h >> 0) & 255) << 0
ctx2.w1[2] = hc_swap32 (uint_to_hex_lower8 ((h >> 0) & 255) << 0
| uint_to_hex_lower8 ((h >> 8) & 255) << 16);
ctx2.w1[3] = hc_swap32(uint_to_hex_lower8 ((h >> 16) & 255) << 0
ctx2.w1[3] = hc_swap32 (uint_to_hex_lower8 ((h >> 16) & 255) << 0
| uint_to_hex_lower8 ((h >> 24) & 255) << 16);
ctx2.len = 32;
@ -244,21 +244,21 @@ KERNEL_FQ void m18500_sxx (KERN_ATTR_RULES ())
sha1_init (&ctx2);
ctx2.w0[0] = hc_swap32(uint_to_hex_lower8 ((e >> 0) & 255) << 0
ctx2.w0[0] = hc_swap32 (uint_to_hex_lower8 ((e >> 0) & 255) << 0
| uint_to_hex_lower8 ((e >> 8) & 255) << 16);
ctx2.w0[1] = hc_swap32(uint_to_hex_lower8 ((e >> 16) & 255) << 0
ctx2.w0[1] = hc_swap32 (uint_to_hex_lower8 ((e >> 16) & 255) << 0
| uint_to_hex_lower8 ((e >> 24) & 255) << 16);
ctx2.w0[2] = hc_swap32(uint_to_hex_lower8 ((f >> 0) & 255) << 0
ctx2.w0[2] = hc_swap32 (uint_to_hex_lower8 ((f >> 0) & 255) << 0
| uint_to_hex_lower8 ((f >> 8) & 255) << 16);
ctx2.w0[3] = hc_swap32(uint_to_hex_lower8 ((f >> 16) & 255) << 0
ctx2.w0[3] = hc_swap32 (uint_to_hex_lower8 ((f >> 16) & 255) << 0
| uint_to_hex_lower8 ((f >> 24) & 255) << 16);
ctx2.w1[0] = hc_swap32(uint_to_hex_lower8 ((g >> 0) & 255) << 0
ctx2.w1[0] = hc_swap32 (uint_to_hex_lower8 ((g >> 0) & 255) << 0
| uint_to_hex_lower8 ((g >> 8) & 255) << 16);
ctx2.w1[1] = hc_swap32(uint_to_hex_lower8 ((g >> 16) & 255) << 0
ctx2.w1[1] = hc_swap32 (uint_to_hex_lower8 ((g >> 16) & 255) << 0
| uint_to_hex_lower8 ((g >> 24) & 255) << 16);
ctx2.w1[2] = hc_swap32(uint_to_hex_lower8 ((h >> 0) & 255) << 0
ctx2.w1[2] = hc_swap32 (uint_to_hex_lower8 ((h >> 0) & 255) << 0
| uint_to_hex_lower8 ((h >> 8) & 255) << 16);
ctx2.w1[3] = hc_swap32(uint_to_hex_lower8 ((h >> 16) & 255) << 0
ctx2.w1[3] = hc_swap32 (uint_to_hex_lower8 ((h >> 16) & 255) << 0
| uint_to_hex_lower8 ((h >> 24) & 255) << 16);
ctx2.len = 32;

View File

@ -115,21 +115,21 @@ KERNEL_FQ void m18500_mxx (KERN_ATTR_RULES ())
sha1_init (&ctx2);
ctx2.w0[0] = hc_swap32(uint_to_hex_lower8 ((e >> 0) & 255) << 0
ctx2.w0[0] = hc_swap32 (uint_to_hex_lower8 ((e >> 0) & 255) << 0
| uint_to_hex_lower8 ((e >> 8) & 255) << 16);
ctx2.w0[1] = hc_swap32(uint_to_hex_lower8 ((e >> 16) & 255) << 0
ctx2.w0[1] = hc_swap32 (uint_to_hex_lower8 ((e >> 16) & 255) << 0
| uint_to_hex_lower8 ((e >> 24) & 255) << 16);
ctx2.w0[2] = hc_swap32(uint_to_hex_lower8 ((f >> 0) & 255) << 0
ctx2.w0[2] = hc_swap32 (uint_to_hex_lower8 ((f >> 0) & 255) << 0
| uint_to_hex_lower8 ((f >> 8) & 255) << 16);
ctx2.w0[3] = hc_swap32(uint_to_hex_lower8 ((f >> 16) & 255) << 0
ctx2.w0[3] = hc_swap32 (uint_to_hex_lower8 ((f >> 16) & 255) << 0
| uint_to_hex_lower8 ((f >> 24) & 255) << 16);
ctx2.w1[0] = hc_swap32(uint_to_hex_lower8 ((g >> 0) & 255) << 0
ctx2.w1[0] = hc_swap32 (uint_to_hex_lower8 ((g >> 0) & 255) << 0
| uint_to_hex_lower8 ((g >> 8) & 255) << 16);
ctx2.w1[1] = hc_swap32(uint_to_hex_lower8 ((g >> 16) & 255) << 0
ctx2.w1[1] = hc_swap32 (uint_to_hex_lower8 ((g >> 16) & 255) << 0
| uint_to_hex_lower8 ((g >> 24) & 255) << 16);
ctx2.w1[2] = hc_swap32(uint_to_hex_lower8 ((h >> 0) & 255) << 0
ctx2.w1[2] = hc_swap32 (uint_to_hex_lower8 ((h >> 0) & 255) << 0
| uint_to_hex_lower8 ((h >> 8) & 255) << 16);
ctx2.w1[3] = hc_swap32(uint_to_hex_lower8 ((h >> 16) & 255) << 0
ctx2.w1[3] = hc_swap32 (uint_to_hex_lower8 ((h >> 16) & 255) << 0
| uint_to_hex_lower8 ((h >> 24) & 255) << 16);
ctx2.len = 32;
@ -242,21 +242,21 @@ KERNEL_FQ void m18500_sxx (KERN_ATTR_RULES ())
sha1_init (&ctx2);
ctx2.w0[0] = hc_swap32(uint_to_hex_lower8 ((e >> 0) & 255) << 0
ctx2.w0[0] = hc_swap32 (uint_to_hex_lower8 ((e >> 0) & 255) << 0
| uint_to_hex_lower8 ((e >> 8) & 255) << 16);
ctx2.w0[1] = hc_swap32(uint_to_hex_lower8 ((e >> 16) & 255) << 0
ctx2.w0[1] = hc_swap32 (uint_to_hex_lower8 ((e >> 16) & 255) << 0
| uint_to_hex_lower8 ((e >> 24) & 255) << 16);
ctx2.w0[2] = hc_swap32(uint_to_hex_lower8 ((f >> 0) & 255) << 0
ctx2.w0[2] = hc_swap32 (uint_to_hex_lower8 ((f >> 0) & 255) << 0
| uint_to_hex_lower8 ((f >> 8) & 255) << 16);
ctx2.w0[3] = hc_swap32(uint_to_hex_lower8 ((f >> 16) & 255) << 0
ctx2.w0[3] = hc_swap32 (uint_to_hex_lower8 ((f >> 16) & 255) << 0
| uint_to_hex_lower8 ((f >> 24) & 255) << 16);
ctx2.w1[0] = hc_swap32(uint_to_hex_lower8 ((g >> 0) & 255) << 0
ctx2.w1[0] = hc_swap32 (uint_to_hex_lower8 ((g >> 0) & 255) << 0
| uint_to_hex_lower8 ((g >> 8) & 255) << 16);
ctx2.w1[1] = hc_swap32(uint_to_hex_lower8 ((g >> 16) & 255) << 0
ctx2.w1[1] = hc_swap32 (uint_to_hex_lower8 ((g >> 16) & 255) << 0
| uint_to_hex_lower8 ((g >> 24) & 255) << 16);
ctx2.w1[2] = hc_swap32(uint_to_hex_lower8 ((h >> 0) & 255) << 0
ctx2.w1[2] = hc_swap32 (uint_to_hex_lower8 ((h >> 0) & 255) << 0
| uint_to_hex_lower8 ((h >> 8) & 255) << 16);
ctx2.w1[3] = hc_swap32(uint_to_hex_lower8 ((h >> 16) & 255) << 0
ctx2.w1[3] = hc_swap32 (uint_to_hex_lower8 ((h >> 16) & 255) << 0
| uint_to_hex_lower8 ((h >> 24) & 255) << 16);
ctx2.len = 32;

View File

@ -125,21 +125,21 @@ KERNEL_FQ void m18500_mxx (KERN_ATTR_VECTOR ())
sha1_init (&ctx2);
ctx2.w0[0] = hc_swap32(uint_to_hex_lower8 ((e >> 0) & 255) << 0
ctx2.w0[0] = hc_swap32 (uint_to_hex_lower8 ((e >> 0) & 255) << 0
| uint_to_hex_lower8 ((e >> 8) & 255) << 16);
ctx2.w0[1] = hc_swap32(uint_to_hex_lower8 ((e >> 16) & 255) << 0
ctx2.w0[1] = hc_swap32 (uint_to_hex_lower8 ((e >> 16) & 255) << 0
| uint_to_hex_lower8 ((e >> 24) & 255) << 16);
ctx2.w0[2] = hc_swap32(uint_to_hex_lower8 ((f >> 0) & 255) << 0
ctx2.w0[2] = hc_swap32 (uint_to_hex_lower8 ((f >> 0) & 255) << 0
| uint_to_hex_lower8 ((f >> 8) & 255) << 16);
ctx2.w0[3] = hc_swap32(uint_to_hex_lower8 ((f >> 16) & 255) << 0
ctx2.w0[3] = hc_swap32 (uint_to_hex_lower8 ((f >> 16) & 255) << 0
| uint_to_hex_lower8 ((f >> 24) & 255) << 16);
ctx2.w1[0] = hc_swap32(uint_to_hex_lower8 ((g >> 0) & 255) << 0
ctx2.w1[0] = hc_swap32 (uint_to_hex_lower8 ((g >> 0) & 255) << 0
| uint_to_hex_lower8 ((g >> 8) & 255) << 16);
ctx2.w1[1] = hc_swap32(uint_to_hex_lower8 ((g >> 16) & 255) << 0
ctx2.w1[1] = hc_swap32 (uint_to_hex_lower8 ((g >> 16) & 255) << 0
| uint_to_hex_lower8 ((g >> 24) & 255) << 16);
ctx2.w1[2] = hc_swap32(uint_to_hex_lower8 ((h >> 0) & 255) << 0
ctx2.w1[2] = hc_swap32 (uint_to_hex_lower8 ((h >> 0) & 255) << 0
| uint_to_hex_lower8 ((h >> 8) & 255) << 16);
ctx2.w1[3] = hc_swap32(uint_to_hex_lower8 ((h >> 16) & 255) << 0
ctx2.w1[3] = hc_swap32 (uint_to_hex_lower8 ((h >> 16) & 255) << 0
| uint_to_hex_lower8 ((h >> 24) & 255) << 16);
ctx2.len = 32;
@ -264,21 +264,21 @@ KERNEL_FQ void m18500_sxx (KERN_ATTR_VECTOR ())
sha1_init (&ctx2);
ctx2.w0[0] = hc_swap32(uint_to_hex_lower8 ((e >> 0) & 255) << 0
ctx2.w0[0] = hc_swap32 (uint_to_hex_lower8 ((e >> 0) & 255) << 0
| uint_to_hex_lower8 ((e >> 8) & 255) << 16);
ctx2.w0[1] = hc_swap32(uint_to_hex_lower8 ((e >> 16) & 255) << 0
ctx2.w0[1] = hc_swap32 (uint_to_hex_lower8 ((e >> 16) & 255) << 0
| uint_to_hex_lower8 ((e >> 24) & 255) << 16);
ctx2.w0[2] = hc_swap32(uint_to_hex_lower8 ((f >> 0) & 255) << 0
ctx2.w0[2] = hc_swap32 (uint_to_hex_lower8 ((f >> 0) & 255) << 0
| uint_to_hex_lower8 ((f >> 8) & 255) << 16);
ctx2.w0[3] = hc_swap32(uint_to_hex_lower8 ((f >> 16) & 255) << 0
ctx2.w0[3] = hc_swap32 (uint_to_hex_lower8 ((f >> 16) & 255) << 0
| uint_to_hex_lower8 ((f >> 24) & 255) << 16);
ctx2.w1[0] = hc_swap32(uint_to_hex_lower8 ((g >> 0) & 255) << 0
ctx2.w1[0] = hc_swap32 (uint_to_hex_lower8 ((g >> 0) & 255) << 0
| uint_to_hex_lower8 ((g >> 8) & 255) << 16);
ctx2.w1[1] = hc_swap32(uint_to_hex_lower8 ((g >> 16) & 255) << 0
ctx2.w1[1] = hc_swap32 (uint_to_hex_lower8 ((g >> 16) & 255) << 0
| uint_to_hex_lower8 ((g >> 24) & 255) << 16);
ctx2.w1[2] = hc_swap32(uint_to_hex_lower8 ((h >> 0) & 255) << 0
ctx2.w1[2] = hc_swap32 (uint_to_hex_lower8 ((h >> 0) & 255) << 0
| uint_to_hex_lower8 ((h >> 8) & 255) << 16);
ctx2.w1[3] = hc_swap32(uint_to_hex_lower8 ((h >> 16) & 255) << 0
ctx2.w1[3] = hc_swap32 (uint_to_hex_lower8 ((h >> 16) & 255) << 0
| uint_to_hex_lower8 ((h >> 24) & 255) << 16);
ctx2.len = 32;

View File

@ -513,7 +513,7 @@ KERNEL_FQ void m19600_comp (KERN_ATTR_TMPS_ESALT (krb5tgs_17_tmp_t, krb5tgs_17_t
int last_block_size = edata2_len % 16;
if(last_block_size == 0)
if (last_block_size == 0)
{
last_block_size = 16;
}
@ -991,9 +991,9 @@ KERNEL_FQ void m19600_comp (KERN_ATTR_TMPS_ESALT (krb5tgs_17_tmp_t, krb5tgs_17_t
sha1_hmac_update_64 (&sha1_hmac_ctx, w0, w1, w2, w3, 16 + last_block_size);
sha1_hmac_final(&sha1_hmac_ctx);
sha1_hmac_final (&sha1_hmac_ctx);
if(sha1_hmac_ctx.opad.h[0] == esalt_bufs[digests_offset].checksum[0]
if (sha1_hmac_ctx.opad.h[0] == esalt_bufs[digests_offset].checksum[0]
&& sha1_hmac_ctx.opad.h[1] == esalt_bufs[digests_offset].checksum[1]
&& sha1_hmac_ctx.opad.h[2] == esalt_bufs[digests_offset].checksum[2])
{

View File

@ -590,7 +590,7 @@ KERNEL_FQ void m19700_comp (KERN_ATTR_TMPS_ESALT (krb5tgs_18_tmp_t, krb5tgs_18_t
int last_block_size = edata2_len % 16;
if(last_block_size == 0)
if (last_block_size == 0)
{
last_block_size = 16;
}
@ -1055,9 +1055,9 @@ KERNEL_FQ void m19700_comp (KERN_ATTR_TMPS_ESALT (krb5tgs_18_tmp_t, krb5tgs_18_t
sha1_hmac_update_64 (&sha1_hmac_ctx, w0, w1, w2, w3, 16 + last_block_size);
sha1_hmac_final(&sha1_hmac_ctx);
sha1_hmac_final (&sha1_hmac_ctx);
if(sha1_hmac_ctx.opad.h[0] == esalt_bufs[digests_offset].checksum[0]
if (sha1_hmac_ctx.opad.h[0] == esalt_bufs[digests_offset].checksum[0]
&& sha1_hmac_ctx.opad.h[1] == esalt_bufs[digests_offset].checksum[1]
&& sha1_hmac_ctx.opad.h[2] == esalt_bufs[digests_offset].checksum[2])
{

View File

@ -5068,7 +5068,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
hcfree (opencl_platforms_vendor); \
hcfree (opencl_platforms_vendor_id); \
hcfree (opencl_platforms_version); \
} while(0)
} while (0)
cl_platform_id *opencl_platforms = (cl_platform_id *) hccalloc (CL_PLATFORMS_MAX, sizeof (cl_platform_id));
cl_uint opencl_platforms_cnt = 0;

View File

@ -255,15 +255,15 @@ int hc_fseek (HCFILE *fp, off_t offset, int whence)
zlib_filefunc64_32_def *d = NULL;
if (whence == SEEK_SET)
{
r = ZSEEK64(*d, fp->ufp, offset, ZLIB_FILEFUNC_SEEK_SET);
r = ZSEEK64 (*d, fp->ufp, offset, ZLIB_FILEFUNC_SEEK_SET);
}
else if (whence == SEEK_CUR)
{
r = ZSEEK64(*d, fp->ufp, offset, ZLIB_FILEFUNC_SEEK_CUR);
r = ZSEEK64 (*d, fp->ufp, offset, ZLIB_FILEFUNC_SEEK_CUR);
}
else if (whence == SEEK_END)
{
r = ZSEEK64(*d, fp->ufp, offset, ZLIB_FILEFUNC_SEEK_END);
r = ZSEEK64 (*d, fp->ufp, offset, ZLIB_FILEFUNC_SEEK_END);
}
// or
// r = unzSetOffset (fp->ufp, offset);

View File

@ -1265,7 +1265,7 @@ int hashcat_session_destroy (hashcat_ctx_t *hashcat_ctx)
if (user_options->brain_client == true)
{
WSACleanup();
WSACleanup ();
}
#endif
#endif

View File

@ -456,7 +456,7 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
#elif defined (__CYGWIN__)
nvml->lib = hc_dlopen("nvml.dll");
nvml->lib = hc_dlopen ("nvml.dll");
if (!nvml->lib)
{
@ -2252,7 +2252,7 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
hcfree (hm_adapters_nvapi); \
hcfree (hm_adapters_nvml); \
hcfree (hm_adapters_sysfs); \
} while(0)
} while (0)
if (backend_ctx->need_nvml == true)
{

View File

@ -547,7 +547,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char *ptr_data = line_buf;
ptr_data += strlen(line_buf);
ptr_data += strlen (line_buf);
*ptr_data = '*';
ptr_data++;
@ -594,7 +594,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sprintf (ptr_data, "%u", contents_len);
ptr_data += strlen(ptr_contents_len);
ptr_data += strlen (ptr_contents_len);
*ptr_data = '*';
ptr_data++;
@ -616,6 +616,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8)
sprintf (ptr_data, "%08x", ptr_contents_hash[i]);
}
if (keyfile_len)
{
*ptr_data = '*';

View File

@ -335,7 +335,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
SID[i] = SID_tmp[j];
}
hcfree(SID_tmp);
hcfree (SID_tmp);
for (u32 i = 0; i < iv_len / 8; i++)
{
@ -361,9 +361,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (contents_len == 208)
{
memcpy (cipher_algorithm, "des3", strlen("des3"));
memcpy (cipher_algorithm, "des3", strlen ("des3"));
memcpy (hash_algorithm, "sha1", strlen("sha1"));
memcpy (hash_algorithm, "sha1", strlen ("sha1"));
}
const int line_len = snprintf (line_buf, line_size, "%s%u*%u*%s*%s*%s*%u*%s*%u*%s",

View File

@ -301,7 +301,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// convert back SID
SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8));
SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof (u8));
for (u32 i = 0; i < (SID_len / 4) + 1; i++)
{

View File

@ -134,7 +134,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
token.signatures_cnt = 1;
token.signatures_buf[0] = SIGNATURE_KRB5ASREP;
token.len[0] = strlen(SIGNATURE_KRB5ASREP);
token.len[0] = strlen (SIGNATURE_KRB5ASREP);
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
| TOKEN_ATTR_VERIFY_SIGNATURE;

View File

@ -194,12 +194,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
user_pos = token.buf[1];
user_len = token.len[1];
memcpy(krb5tgs->user, user_pos, user_len);
memcpy (krb5tgs->user, user_pos, user_len);
domain_pos = token.buf[2];
domain_len = token.len[2];
memcpy(krb5tgs->domain, domain_pos, domain_len);
memcpy (krb5tgs->domain, domain_pos, domain_len);
checksum_pos = token.buf[3 + is_spn_provided];
@ -211,12 +211,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5tgs->account_info;
// domain must be uppercase
u8 domain[128];
memcpy(domain, domain_pos, domain_len);
uppercase(domain, domain_len);
memcpy(account_info_ptr, domain, domain_len);
memcpy(account_info_ptr + domain_len, user_pos, user_len);
u8 domain[128];
memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len);
memcpy (account_info_ptr, domain, domain_len);
memcpy (account_info_ptr + domain_len, user_pos, user_len);
krb5tgs->account_info_len = account_info_len;

View File

@ -194,12 +194,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
user_pos = token.buf[1];
user_len = token.len[1];
memcpy(krb5tgs->user, user_pos, user_len);
memcpy (krb5tgs->user, user_pos, user_len);
domain_pos = token.buf[2];
domain_len = token.len[2];
memcpy(krb5tgs->domain, domain_pos, domain_len);
memcpy (krb5tgs->domain, domain_pos, domain_len);
checksum_pos = token.buf[3 + is_spn_provided];
@ -211,12 +211,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5tgs->account_info;
// domain must be uppercase
u8 domain[128];
memcpy(domain, domain_pos, domain_len);
uppercase(domain, domain_len);
memcpy(account_info_ptr, domain, domain_len);
memcpy(account_info_ptr + domain_len, user_pos, user_len);
u8 domain[128];
memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len);
memcpy (account_info_ptr, domain, domain_len);
memcpy (account_info_ptr + domain_len, user_pos, user_len);
krb5tgs->account_info_len = account_info_len;

View File

@ -138,12 +138,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
user_pos = token.buf[1];
user_len = token.len[1];
memcpy(krb5pa->user, user_pos, user_len);
memcpy (krb5pa->user, user_pos, user_len);
domain_pos = token.buf[2];
domain_len = token.len[2];
memcpy(krb5pa->domain, domain_pos, domain_len);
memcpy (krb5pa->domain, domain_pos, domain_len);
data_pos = token.buf[3];
data_len = token.len[3];
@ -153,12 +153,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5pa->account_info;
// domain must be uppercase
u8 domain[128];
memcpy(domain, domain_pos, domain_len);
uppercase(domain, domain_len);
memcpy(account_info_ptr, domain, domain_len);
memcpy(account_info_ptr + domain_len, user_pos, user_len);
u8 domain[128];
memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len);
memcpy (account_info_ptr, domain, domain_len);
memcpy (account_info_ptr + domain_len, user_pos, user_len);
krb5pa->account_info_len = account_info_len;

View File

@ -138,12 +138,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
user_pos = token.buf[1];
user_len = token.len[1];
memcpy(krb5pa->user, user_pos, user_len);
memcpy (krb5pa->user, user_pos, user_len);
domain_pos = token.buf[2];
domain_len = token.len[2];
memcpy(krb5pa->domain, domain_pos, domain_len);
memcpy (krb5pa->domain, domain_pos, domain_len);
data_pos = token.buf[3];
data_len = token.len[3];
@ -153,12 +153,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5pa->account_info;
// domain must be uppercase
u8 domain[128];
memcpy(domain, domain_pos, domain_len);
uppercase(domain, domain_len);
memcpy(account_info_ptr, domain, domain_len);
memcpy(account_info_ptr + domain_len, user_pos, user_len);
u8 domain[128];
memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len);
memcpy (account_info_ptr, domain, domain_len);
memcpy (account_info_ptr + domain_len, user_pos, user_len);
krb5pa->account_info_len = account_info_len;

View File

@ -357,7 +357,7 @@ void SetConsoleWindowSize (const int x)
static struct termios savemodes;
static int havemodes = 0;
int tty_break()
int tty_break ()
{
struct termios modmodes;
@ -373,7 +373,7 @@ int tty_break()
return tcsetattr (fileno (stdin), TCSANOW, &modmodes);
}
int tty_getchar()
int tty_getchar ()
{
fd_set rfds;
@ -394,7 +394,7 @@ int tty_getchar()
return getchar();
}
int tty_fix()
int tty_fix ()
{
if (!havemodes) return 0;
@ -406,7 +406,7 @@ int tty_fix()
static struct termios savemodes;
static int havemodes = 0;
int tty_break()
int tty_break ()
{
struct termios modmodes;
@ -422,7 +422,7 @@ int tty_break()
return ioctl (fileno (stdin), TIOCSETAW, &modmodes);
}
int tty_getchar()
int tty_getchar ()
{
fd_set rfds;
@ -443,7 +443,7 @@ int tty_getchar()
return getchar();
}
int tty_fix()
int tty_fix ()
{
if (!havemodes) return 0;
@ -454,7 +454,7 @@ int tty_fix()
#if defined (_WIN)
static DWORD saveMode = 0;
int tty_break()
int tty_break ()
{
HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE);
@ -464,7 +464,7 @@ int tty_break()
return 0;
}
int tty_getchar()
int tty_getchar ()
{
HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE);
@ -504,7 +504,7 @@ int tty_getchar()
return 0;
}
int tty_fix()
int tty_fix ()
{
HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE);
@ -1082,8 +1082,9 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
if (device_num != 0)
{
printf(",");
printf (",");
}
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"speed\": %" PRIu64 ",", (u64) (device_info->hashes_msec_dev * 1000));
@ -1876,14 +1877,15 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
if (device_num != 0)
{
printf(",");
printf (",");
}
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"speed\": %" PRIu64 " }", (u64) (device_info->hashes_msec_dev_benchmark * 1000));
device_num++;
}
printf(" ] }");
printf (" ] }");
status_status_destroy (hashcat_ctx, hashcat_status);
@ -1995,7 +1997,7 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
if (device_num != 0)
{
printf(",");
printf (",");
}
printf (" { \"device_id\": %d,", device_id + 1);
@ -2004,7 +2006,7 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
device_num++;
}
printf(" ] }");
printf (" ] }");
status_status_destroy (hashcat_ctx, hashcat_status);

View File

@ -17,7 +17,7 @@ sub module_generate_hash
my $word = shift;
my $salt = shift;
my $salt_bin = pack("H*", $salt);
my $salt_bin = pack ("H*", $salt);
my $digest = sha1_hex ($word . $salt_bin);

View File

@ -33,9 +33,9 @@ sub module_verify_hash
my ($digest, $word) = split (':', $line);
my ($prefix, $hash) = split('-', $digest);
my ($prefix, $hash) = split ('-', $digest);
my $salt = substr($prefix, 6, 8);
my $salt = substr ($prefix, 6, 8);
return unless defined $hash;
return unless defined $salt;

View File

@ -49,4 +49,3 @@ sub module_verify_hash
}
1;

View File

@ -80,4 +80,3 @@ sub module_verify_hash
}
1;

View File

@ -114,4 +114,3 @@ sub module_verify_hash
}
1;

View File

@ -105,4 +105,3 @@ sub module_verify_hash
}
1;

View File

@ -69,4 +69,3 @@ sub module_verify_hash
}
1;

View File

@ -61,4 +61,3 @@ sub module_verify_hash
}
1;

View File

@ -178,4 +178,3 @@ sub module_verify_hash
}
1;

View File

@ -178,4 +178,3 @@ sub module_verify_hash
}
1;

View File

@ -104,4 +104,3 @@ sub module_verify_hash
}
1;

View File

@ -61,7 +61,7 @@ sub module_generate_hash
my $hash_buf = sha1_hex ($word . substr ($theMagicArray_s, $offsetMagicArray, $lengthMagicArray) . $salt);
my $hash = sprintf("%s\$%.20s%020X", $salt, uc $hash_buf, 0);
my $hash = sprintf ("%s\$%.20s%020X", $salt, uc $hash_buf, 0);
return $hash;
}
@ -104,4 +104,3 @@ sub module_verify_hash
}
1;

View File

@ -89,4 +89,3 @@ sub module_verify_hash
}
1;

View File

@ -88,4 +88,3 @@ sub module_verify_hash
}
1;

View File

@ -84,4 +84,3 @@ sub module_verify_hash
}
1;

View File

@ -47,7 +47,7 @@ sub module_verify_hash
my @data = split (':', $digest);
return unless scalar(@data) == 4;
return unless scalar (@data) == 4;
my $signature = shift @data;

View File

@ -23,20 +23,20 @@ sub module_generate_hash
$salt = random_bytes (16);
}
my $pbkdf2 = Crypt::PBKDF2->new(
my $pbkdf2 = Crypt::PBKDF2->new (
hash_class => 'HMACSHA2',
iterations => $iter,
output_len => 256,
salt_len => 64,
);
my $p = $pbkdf2->generate($word, $salt);
my $p = $pbkdf2->generate ($word, $salt);
my $decoded_hash = $pbkdf2->decode_string($p);
my $decoded_hash = $pbkdf2->decode_string ($p);
my $diter = $decoded_hash->{"iterations"};
my $iterbytes = pack('I', unpack('N*', pack('L*', $diter)));
my $iterbytes = pack ('I', unpack ('N*', pack ('L*', $diter)));
my $dsalt = $decoded_hash->{"salt"};
@ -44,7 +44,7 @@ sub module_generate_hash
my $tmp = $iterbytes . $dsalt . $dhash;
my $hash = "{PBKDF2_SHA256}" . encode_base64($tmp, '');
my $hash = "{PBKDF2_SHA256}" . encode_base64 ($tmp, '');
return $hash;
}
@ -57,11 +57,11 @@ sub module_verify_hash
return unless (substr ($hash, 0, 15) eq '{PBKDF2_SHA256}');
my $hashbytes = decode_base64(substr ($hash, 15, length $hash));
my $hashbytes = decode_base64 (substr ($hash, 15, length $hash));
my $iterbytes = substr $hashbytes, 0, 4;
my $iter = unpack('N*', pack('L*', unpack("I",$iterbytes)));
my $iter = unpack ('N*', pack ('L*', unpack ('I', $iterbytes)));
my $salt = substr $hashbytes, 4, 64;
@ -75,4 +75,3 @@ sub module_verify_hash
}
1;

View File

@ -22,8 +22,8 @@ sub module_generate_hash
import binascii
import sys
from pygost import gost34112012256
digest = gost34112012256.new(b"$word").digest()
sys.stdout.write(binascii.hexlify(digest[::-1]))
digest = gost34112012256.new (b"$word").digest ()
sys.stdout.write (binascii.hexlify (digest[::-1]))
END_CODE

View File

@ -22,8 +22,8 @@ import sys
from pygost import gost34112012256
key = b"$word"
msg = b"$salt"
digest = hmac.new(key, msg, gost34112012256).digest()
sys.stdout.write(binascii.hexlify(digest[::-1]))
digest = hmac.new (key, msg, gost34112012256).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1]))
END_CODE

View File

@ -22,8 +22,8 @@ import sys
from pygost import gost34112012256
key = b"$salt"
msg = b"$word"
digest = hmac.new(key, msg, gost34112012256).digest()
sys.stdout.write(binascii.hexlify(digest[::-1]))
digest = hmac.new (key, msg, gost34112012256).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1]))
END_CODE

View File

@ -19,8 +19,8 @@ sub module_generate_hash
import binascii
import sys
from pygost import gost34112012512
digest = gost34112012512.new(b"$word").digest()
sys.stdout.write(binascii.hexlify(digest[::-1]))
digest = gost34112012512.new (b"$word").digest ()
sys.stdout.write (binascii.hexlify (digest[::-1]))
END_CODE

View File

@ -23,8 +23,8 @@ import sys
from pygost import gost34112012512
key = b"$word"
msg = b"$salt"
digest = hmac.new(key, msg, gost34112012512).digest()
sys.stdout.write(binascii.hexlify(digest[::-1]))
digest = hmac.new (key, msg, gost34112012512).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1]))
END_CODE

View File

@ -23,8 +23,8 @@ import sys
from pygost import gost34112012512
key = b"$salt"
msg = b"$word"
digest = hmac.new(key, msg, gost34112012512).digest()
sys.stdout.write(binascii.hexlify(digest[::-1]))
digest = hmac.new (key, msg, gost34112012512).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1]))
END_CODE

View File

@ -125,7 +125,7 @@ sub module_verify_hash
my @data = split (':', $digest);
return unless scalar(@data) == 4;
return unless scalar (@data) == 4;
my $signature = shift @data;

View File

@ -66,7 +66,7 @@ sub module_verify_hash
my $default_salt = 1;
my ($param, $hash) = split('\$', $digest);
my ($param, $hash) = split ('\$', $digest);
$default_salt = 0 if ($param eq '1');
@ -74,7 +74,7 @@ sub module_verify_hash
if ($default_salt == 0)
{
($salt, $hash) = split('\$', $hash);
($salt, $hash) = split ('\$', $hash);
}
my $word_packed = pack_if_HEX_notation ($word);

View File

@ -73,24 +73,30 @@ sub get_random_dpapimk_salt
return $salt_buf;
}
#Thanks to Jochen Hoenicke <hoenicke@gmail.com>
# Thanks to Jochen Hoenicke <hoenicke@gmail.com>
# (one of the authors of Palm Keyring)
# for these next two subs.
sub dpapi_pbkdf2
{
my ($password, $salt, $iter, $keylen, $prf) = @_;
my ($k, $t, $u, $ui, $i);
$t = "";
for ($k = 1; length ($t) < $keylen; $k++)
{
$u = $ui = &$prf ($salt.pack ('N', $k), $password);
$u = $ui = &$prf ($salt . pack ('N', $k), $password);
for ($i = 1; $i < $iter; $i++)
{
# modification to fit Microsoft
# weird pbkdf2 implementation...
$ui = &$prf ($u, $password);
$u ^= $ui;
}
$t .= $u;
}
return substr ($t, 0, $keylen);

View File

@ -74,26 +74,33 @@ sub get_random_dpapimk_salt
return $salt_buf;
}
#Thanks to Jochen Hoenicke <hoenicke@gmail.com>
# Thanks to Jochen Hoenicke <hoenicke@gmail.com>
# (one of the authors of Palm Keyring)
# for these next two subs.
sub dpapi_pbkdf2
{
my ($password, $salt, $iter, $keylen, $prf) = @_;
my ($k, $t, $u, $ui, $i);
$t = "";
for ($k = 1; length ($t) < $keylen; $k++)
{
$u = $ui = &$prf ($salt.pack ('N', $k), $password);
$u = $ui = &$prf ($salt . pack ('N', $k), $password);
for ($i = 1; $i < $iter; $i++)
{
# modification to fit Microsoft
# weird pbkdf2 implementation...
$ui = &$prf ($u, $password);
$u ^= $ui;
}
$t .= $u;
}
return substr ($t, 0, $keylen);
}

View File

@ -21,7 +21,7 @@ sub module_generate_hash
$md5->{_data} = $word ^ ("\x5c" x $length);
$md5->{_data} .= "\x5c" x (64 - $length);
$md5->add();
$md5->add ();
my $digest = unpack ("H*", pack ('V4', @{$md5->{_state}}));

View File

@ -74,4 +74,3 @@ sub module_verify_hash
}
1;

View File

@ -240,4 +240,3 @@ sub module_verify_hash
}
1;

View File

@ -40,7 +40,7 @@ sub module_generate_hash
my $cipher = unpack ('H*', $b_cipher);
my $checksum = sha256_hex ($b_plain);
my $hash = '$odf$'."*1*1*$iter*32*$checksum*16*$iv*16*$salt*0*$cipher";
my $hash = '$odf$' . "*1*1*$iter*32*$checksum*16*$iv*16*$salt*0*$cipher";
return $hash;
}

View File

@ -54,7 +54,7 @@ sub module_generate_hash
my $cipher = unpack ('H*', $b_cipher);
my $checksum = sha1_hex ($b_plain);
my $hash = '$odf$'."*0*0*$iter*16*$checksum*8*$iv*16*$salt*0*$cipher";
my $hash = '$odf$' . "*0*0*$iter*16*$checksum*8*$iv*16*$salt*0*$cipher";
return $hash;
}
@ -113,7 +113,7 @@ sub module_verify_hash
my $pass_hash = sha1 ($word);
my $key = $kdf->PBKDF2 ($b_salt, $pass_hash);
my $cfb = Crypt::GCrypt->new(
my $cfb = Crypt::GCrypt->new (
type => 'cipher',
algorithm => 'blowfish',
mode => 'cfb'

View File

@ -60,9 +60,9 @@ sub module_generate_hash
my $b_seed = $pbkdf2->PBKDF2 ($mysalt, $word);
# we can precompute this
my $b_kerberos_nfolded = hex2byte('6b65726265726f737b9b5b2b93132b93');
my $b_kerberos_nfolded = hex2byte ('6b65726265726f737b9b5b2b93132b93');
my $b_iv = hex2byte('0' x 32);
my $b_iv = hex2byte ('0' x 32);
# 'key_bytes' will be the AES key used to generate 'ki' (for final hmac-sha1)
# and 'ke' (AES key to decrypt/encrypt the ticket)
@ -70,8 +70,8 @@ sub module_generate_hash
my $b_key_bytes = $cbc->encrypt ($b_kerberos_nfolded, $b_seed, $b_iv);
# precomputed stuff
my $b_nfolded1 = hex2byte('62dc6e371a63a80958ac562b15404ac5');
my $b_nfolded2 = hex2byte('b5b0582c14b6500aad56ab55aa80556a');
my $b_nfolded1 = hex2byte ('62dc6e371a63a80958ac562b15404ac5');
my $b_nfolded2 = hex2byte ('b5b0582c14b6500aad56ab55aa80556a');
my $b_ki = $cbc->encrypt ($b_nfolded1, $b_key_bytes, $b_iv);
my $b_ke = $cbc->encrypt ($b_nfolded2, $b_key_bytes, $b_iv);
@ -85,7 +85,7 @@ sub module_generate_hash
if (defined $edata2)
{
my $len_last_block = length($edata2) % 32;
my $len_last_block = length ($edata2) % 32;
my $tmp = $len_last_block + 32;
@ -93,11 +93,11 @@ sub module_generate_hash
my $b_last_block = hex2byte (substr $edata2, -$len_last_block);
my $b_n_1_block = hex2byte (substr(substr($edata2, -$tmp), 0, 32));
my $b_n_1_block = hex2byte (substr (substr ($edata2, -$tmp), 0, 32));
my $b_truncated_ticket_decrypted = $cbc->decrypt ($b_truncated_enc_ticket, $b_ke, $b_iv);
my $truncated_ticket_decrypted = byte2hex($b_truncated_ticket_decrypted);
my $truncated_ticket_decrypted = byte2hex ($b_truncated_ticket_decrypted);
my $check_correct = ((substr ($truncated_ticket_decrypted, 32, 4) eq "6381" && substr ($truncated_ticket_decrypted, 38, 2) eq "30") ||
(substr ($truncated_ticket_decrypted, 32, 4) eq "6382")) &&
@ -110,11 +110,11 @@ sub module_generate_hash
my $b_n_1_decrypted = $cbc->decrypt ($b_n_1_block, $b_ke, $b_iv);
my $b_last_plain = substr $b_n_1_decrypted, 0, $len_last_block/2;
my $b_last_plain = substr $b_n_1_decrypted, 0, $len_last_block / 2;
$b_last_plain = $b_last_plain ^ $b_last_block;
my $omitted = substr $b_n_1_decrypted, -(16 - $len_last_block/2);
my $omitted = substr $b_n_1_decrypted, -(16 - $len_last_block / 2);
my $b_n_1 = $b_last_block . $omitted;
@ -124,7 +124,7 @@ sub module_generate_hash
my $b_cleartext_ticket = $b_truncated_ticket_decrypted . $b_n_1 . $b_last_plain;
$cleartext_ticket = byte2hex($b_cleartext_ticket);
$cleartext_ticket = byte2hex ($b_cleartext_ticket);
}
else # validation failed
{
@ -147,26 +147,26 @@ sub module_generate_hash
$cleartext_ticket = $nonce . $cleartext_ticket;
}
# we have what is required to compute checksum
$checksum = hmac_sha1 (hex2byte($cleartext_ticket), $b_ki);
$checksum = hmac_sha1 (hex2byte ($cleartext_ticket), $b_ki);
$checksum = substr $checksum, 0, 12;
}
my $len_cleartext_last_block = length($cleartext_ticket) % 32;
my $len_cleartext_last_block = length ($cleartext_ticket) % 32;
my $cleartext_last_block = substr $cleartext_ticket, -$len_cleartext_last_block;
my $padding = pad(length($cleartext_ticket), 32);
my $padding = pad (length ($cleartext_ticket), 32);
my $b_cleartext_last_block_padded = hex2byte($cleartext_last_block . '0' x $padding);
my $b_cleartext_last_block_padded = hex2byte ($cleartext_last_block . '0' x $padding);
# we will encrypt until n-1 block (included)
my $truncated_cleartext_ticket = substr $cleartext_ticket, 0, -$len_cleartext_last_block;
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte ($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_enc_ticket_n_1_block= substr $b_truncated_enc_ticket, -16;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block/2;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block / 2;
# we now craft the new n-1 block
my $tmp = $b_enc_ticket_n_1_block ^ $b_cleartext_last_block_padded;

View File

@ -60,9 +60,9 @@ sub module_generate_hash
my $b_seed = $pbkdf2->PBKDF2 ($mysalt, $word);
# we can precompute this
my $b_kerberos_nfolded = hex2byte('6b65726265726f737b9b5b2b93132b93');
my $b_kerberos_nfolded = hex2byte ('6b65726265726f737b9b5b2b93132b93');
my $b_iv = hex2byte('0' x 32);
my $b_iv = hex2byte ('0' x 32);
# 'key_bytes' will be the AES key used to generate 'ki' (for final hmac-sha1)
# and 'ke' (AES key to decrypt/encrypt the ticket)
@ -72,8 +72,8 @@ sub module_generate_hash
$b_key_bytes = $b_key_bytes . $cbc->encrypt ($b_key_bytes, $b_seed, $b_iv);
# precomputed stuff
my $b_nfolded1 = hex2byte('62dc6e371a63a80958ac562b15404ac5');
my $b_nfolded2 = hex2byte('b5b0582c14b6500aad56ab55aa80556a');
my $b_nfolded1 = hex2byte ('62dc6e371a63a80958ac562b15404ac5');
my $b_nfolded2 = hex2byte ('b5b0582c14b6500aad56ab55aa80556a');
my $b_ki = $cbc->encrypt ($b_nfolded1, $b_key_bytes, $b_iv);
@ -92,7 +92,7 @@ sub module_generate_hash
if (defined $edata2)
{
my $len_last_block = length($edata2) % 32;
my $len_last_block = length ($edata2) % 32;
my $tmp = $len_last_block + 32;
@ -100,11 +100,11 @@ sub module_generate_hash
my $b_last_block = hex2byte (substr $edata2, -$len_last_block);
my $b_n_1_block = hex2byte (substr(substr($edata2, -$tmp), 0, 32));
my $b_n_1_block = hex2byte (substr (substr ($edata2, -$tmp), 0, 32));
my $b_truncated_ticket_decrypted = $cbc->decrypt ($b_truncated_enc_ticket, $b_ke, $b_iv);
my $truncated_ticket_decrypted = byte2hex($b_truncated_ticket_decrypted);
my $truncated_ticket_decrypted = byte2hex ($b_truncated_ticket_decrypted);
my $check_correct = ((substr ($truncated_ticket_decrypted, 32, 4) eq "6381" && substr ($truncated_ticket_decrypted, 38, 2) eq "30") ||
(substr ($truncated_ticket_decrypted, 32, 4) eq "6382")) &&
@ -117,11 +117,11 @@ sub module_generate_hash
my $b_n_1_decrypted = $cbc->decrypt ($b_n_1_block, $b_ke, $b_iv);
my $b_last_plain = substr $b_n_1_decrypted, 0, $len_last_block/2;
my $b_last_plain = substr $b_n_1_decrypted, 0, $len_last_block / 2;
$b_last_plain = $b_last_plain ^ $b_last_block;
my $omitted = substr $b_n_1_decrypted, -(16 - $len_last_block/2);
my $omitted = substr $b_n_1_decrypted, -(16 - $len_last_block / 2);
my $b_n_1 = $b_last_block . $omitted;
@ -131,7 +131,7 @@ sub module_generate_hash
my $b_cleartext_ticket = $b_truncated_ticket_decrypted . $b_n_1 . $b_last_plain;
$cleartext_ticket = byte2hex($b_cleartext_ticket);
$cleartext_ticket = byte2hex ($b_cleartext_ticket);
}
else # validation failed
{
@ -154,26 +154,26 @@ sub module_generate_hash
$cleartext_ticket = $nonce . $cleartext_ticket;
}
# we have what is required to compute checksum
$checksum = hmac_sha1 (hex2byte($cleartext_ticket), $b_ki);
$checksum = hmac_sha1 (hex2byte ($cleartext_ticket), $b_ki);
$checksum = substr $checksum, 0, 12;
}
my $len_cleartext_last_block = length($cleartext_ticket)%32;
my $len_cleartext_last_block = length ($cleartext_ticket) % 32;
my $cleartext_last_block = substr $cleartext_ticket, -$len_cleartext_last_block;
my $padding = pad(length($cleartext_ticket), 32);
my $padding = pad (length ($cleartext_ticket), 32);
my $b_cleartext_last_block_padded = hex2byte($cleartext_last_block . '0' x $padding);
my $b_cleartext_last_block_padded = hex2byte ($cleartext_last_block . '0' x $padding);
# we will encrypt until n-1 block (included)
my $truncated_cleartext_ticket = substr $cleartext_ticket, 0, -$len_cleartext_last_block;
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte ($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_enc_ticket_n_1_block= substr $b_truncated_enc_ticket, -16;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block/2;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block / 2;
# we now craft the new n-1 block
my $tmp = $b_enc_ticket_n_1_block ^ $b_cleartext_last_block_padded;

View File

@ -60,9 +60,9 @@ sub module_generate_hash
my $b_seed = $pbkdf2->PBKDF2 ($mysalt, $word);
# we can precompute this
my $b_kerberos_nfolded = hex2byte('6b65726265726f737b9b5b2b93132b93');
my $b_kerberos_nfolded = hex2byte ('6b65726265726f737b9b5b2b93132b93');
my $b_iv = hex2byte('0' x 32);
my $b_iv = hex2byte ('0' x 32);
# 'key_bytes' will be the AES key used to generate 'ki' (for final hmac-sha1)
# and 'ke' (AES key to decrypt/encrypt the ticket)
@ -71,10 +71,10 @@ sub module_generate_hash
# precomputed stuff
# nfold 0x0000000155 to 16 bytes
my $b_nfolded1 = hex2byte('5b582c160a5aa80556ab55aad5402ab5');
my $b_nfolded1 = hex2byte ('5b582c160a5aa80556ab55aad5402ab5');
# nfold 0x00000001aa to 16 bytes
my $b_nfolded2 = hex2byte('ae2c160b04ad5006ab55aad56a80355a');
my $b_nfolded2 = hex2byte ('ae2c160b04ad5006ab55aad56a80355a');
my $b_ki = $cbc->encrypt ($b_nfolded1, $b_key_bytes, $b_iv);
@ -88,36 +88,36 @@ sub module_generate_hash
{
# Do CTS Decryption https://en.wikipedia.org/wiki/Ciphertext_stealing
# Decrypt n-1 block
my $len_last_block = length($enc_timestamp) % 32;
my $len_last_block = length ($enc_timestamp) % 32;
my $len_last_2_blocks = $len_last_block + 32;
my $b_n_1_block = hex2byte (substr($enc_timestamp, -$len_last_2_blocks, 32));
my $b_n_1_block = hex2byte (substr ($enc_timestamp, -$len_last_2_blocks, 32));
my $b_n_1_decrypted = $cbc->decrypt ($b_n_1_block, $b_ke, $b_iv);
# Pad the last block with last bytes from the decrypted n-1
my $b_padded_enc_ticket = hex2byte($enc_timestamp).(substr $b_n_1_decrypted, -(16 - $len_last_block/2));
my $b_padded_enc_ticket = hex2byte ($enc_timestamp) . (substr $b_n_1_decrypted, -(16 - $len_last_block / 2));
# Swap the last two blocks
my $b_cbc_enc_ticket = (substr $b_padded_enc_ticket, 0, -32).(substr $b_padded_enc_ticket, -16, 16).
my $b_cbc_enc_ticket = (substr $b_padded_enc_ticket, 0, -32) . (substr $b_padded_enc_ticket, -16, 16).
(substr $b_padded_enc_ticket, -32, 16);
# Decrypt and truncate
my $b_dec_ticket_padded = $cbc->decrypt ($b_cbc_enc_ticket, $b_ke, $b_iv);
my $b_cleartext_ticket = substr $b_dec_ticket_padded, 0, length($enc_timestamp)/2;
my $b_cleartext_ticket = substr $b_dec_ticket_padded, 0, length ($enc_timestamp) / 2;
$cleartext_ticket = byte2hex($b_cleartext_ticket);
$cleartext_ticket = byte2hex ($b_cleartext_ticket);
my $check_correct = ((substr ($b_cleartext_ticket, 22, 2) eq "20") &&
(substr ($b_cleartext_ticket, 36, 1) eq "Z"));
if ($check_correct == 1 && defined $checksum)
{
my $b_checksum = hmac_sha1 (hex2byte($cleartext_ticket), $b_ki);
my $b_checksum = hmac_sha1 (hex2byte ($cleartext_ticket), $b_ki);
$check_correct = ($checksum eq byte2hex(substr $b_checksum, 0, 12));
$check_correct = ($checksum eq byte2hex (substr $b_checksum, 0, 12));
}
}
@ -129,27 +129,27 @@ sub module_generate_hash
'32313131363134323835355aa10502030c28a2';
# we have what is required to compute checksum
$checksum = hmac_sha1 (hex2byte($cleartext_ticket), $b_ki);
$checksum = hmac_sha1 (hex2byte ($cleartext_ticket), $b_ki);
$checksum = byte2hex(substr $checksum, 0, 12);
$checksum = byte2hex (substr $checksum, 0, 12);
}
# CTS Encrypt our new block
my $len_cleartext_last_block = length($cleartext_ticket)%32;
my $len_cleartext_last_block = length ($cleartext_ticket) % 32;
my $cleartext_last_block = substr $cleartext_ticket, -$len_cleartext_last_block;
my $padding = pad(length($cleartext_ticket), 32);
my $padding = pad (length ($cleartext_ticket), 32);
my $b_cleartext_last_block_padded = hex2byte($cleartext_last_block . '0' x $padding);
my $b_cleartext_last_block_padded = hex2byte ($cleartext_last_block . '0' x $padding);
# we will encrypt until n-1 block (included)
my $truncated_cleartext_ticket = substr $cleartext_ticket, 0, -$len_cleartext_last_block;
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte ($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_enc_ticket_n_1_block= substr $b_truncated_enc_ticket, -16;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block/2;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block / 2;
# we now craft the new n-1 block
my $tmp = $b_enc_ticket_n_1_block ^ $b_cleartext_last_block_padded;

View File

@ -60,9 +60,9 @@ sub module_generate_hash
my $b_seed = $pbkdf2->PBKDF2 ($mysalt, $word);
# we can precompute this
my $b_kerberos_nfolded = hex2byte('6b65726265726f737b9b5b2b93132b93');
my $b_kerberos_nfolded = hex2byte ('6b65726265726f737b9b5b2b93132b93');
my $b_iv = hex2byte('0' x 32);
my $b_iv = hex2byte ('0' x 32);
# 'key_bytes' will be the AES key used to generate 'ki' (for final hmac-sha1)
# and 'ke' (AES key to decrypt/encrypt the ticket)
@ -73,10 +73,10 @@ sub module_generate_hash
# precomputed stuff
# nfold 0x0000000155 to 16 bytes
my $b_nfolded1 = hex2byte('5b582c160a5aa80556ab55aad5402ab5');
my $b_nfolded1 = hex2byte ('5b582c160a5aa80556ab55aad5402ab5');
# nfold 0x00000001aa to 16 bytes
my $b_nfolded2 = hex2byte('ae2c160b04ad5006ab55aad56a80355a');
my $b_nfolded2 = hex2byte ('ae2c160b04ad5006ab55aad56a80355a');
my $b_ki = $cbc->encrypt ($b_nfolded1, $b_key_bytes, $b_iv);
@ -93,36 +93,36 @@ sub module_generate_hash
{
# Do CTS Decryption https://en.wikipedia.org/wiki/Ciphertext_stealing
# Decrypt n-1 block
my $len_last_block = length($enc_timestamp) % 32;
my $len_last_block = length ($enc_timestamp) % 32;
my $len_last_2_blocks = $len_last_block + 32;
my $b_n_1_block = hex2byte (substr($enc_timestamp, -$len_last_2_blocks, 32));
my $b_n_1_block = hex2byte (substr ($enc_timestamp, -$len_last_2_blocks, 32));
my $b_n_1_decrypted = $cbc->decrypt ($b_n_1_block, $b_ke, $b_iv);
# Pad the last block with last bytes from the decrypted n-1
my $b_padded_enc_ticket = hex2byte($enc_timestamp).(substr $b_n_1_decrypted, -(16 - $len_last_block/2));
my $b_padded_enc_ticket = hex2byte ($enc_timestamp) . (substr $b_n_1_decrypted, -(16 - $len_last_block / 2));
# Swap the last two blocks
my $b_cbc_enc_ticket = (substr $b_padded_enc_ticket, 0, -32).(substr $b_padded_enc_ticket, -16, 16).
my $b_cbc_enc_ticket = (substr $b_padded_enc_ticket, 0, -32) . (substr $b_padded_enc_ticket, -16, 16).
(substr $b_padded_enc_ticket, -32, 16);
# Decrypt and truncate
my $b_dec_ticket_padded = $cbc->decrypt ($b_cbc_enc_ticket, $b_ke, $b_iv);
my $b_cleartext_ticket = substr $b_dec_ticket_padded, 0, length($enc_timestamp)/2;
my $b_cleartext_ticket = substr $b_dec_ticket_padded, 0, length ($enc_timestamp) / 2;
$cleartext_ticket = byte2hex($b_cleartext_ticket);
$cleartext_ticket = byte2hex ($b_cleartext_ticket);
my $check_correct = ((substr ($b_cleartext_ticket, 22, 2) eq "20") &&
(substr ($b_cleartext_ticket, 36, 1) eq "Z"));
if ($check_correct == 1 && defined $checksum)
{
my $b_checksum = hmac_sha1 (hex2byte($cleartext_ticket), $b_ki);
my $b_checksum = hmac_sha1 (hex2byte ($cleartext_ticket), $b_ki);
$check_correct = ($checksum eq byte2hex(substr $b_checksum, 0, 12));
$check_correct = ($checksum eq byte2hex (substr $b_checksum, 0, 12));
}
}
@ -134,27 +134,27 @@ sub module_generate_hash
'32313131363134323835355aa10502030c28a2';
# we have what is required to compute checksum
$checksum = hmac_sha1 (hex2byte($cleartext_ticket), $b_ki);
$checksum = hmac_sha1 (hex2byte ($cleartext_ticket), $b_ki);
$checksum = byte2hex(substr $checksum, 0, 12);
$checksum = byte2hex (substr $checksum, 0, 12);
}
# CTS Encrypt our new block
my $len_cleartext_last_block = length($cleartext_ticket)%32;
my $len_cleartext_last_block = length ($cleartext_ticket) % 32;
my $cleartext_last_block = substr $cleartext_ticket, -$len_cleartext_last_block;
my $padding = pad(length($cleartext_ticket), 32);
my $padding = pad (length ($cleartext_ticket), 32);
my $b_cleartext_last_block_padded = hex2byte($cleartext_last_block . '0' x $padding);
my $b_cleartext_last_block_padded = hex2byte ($cleartext_last_block . '0' x $padding);
# we will encrypt until n-1 block (included)
my $truncated_cleartext_ticket = substr $cleartext_ticket, 0, -$len_cleartext_last_block;
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_truncated_enc_ticket = $cbc->encrypt (hex2byte ($truncated_cleartext_ticket), $b_ke, $b_iv);
my $b_enc_ticket_n_1_block= substr $b_truncated_enc_ticket, -16;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block/2;
my $b_enc_last_block = substr $b_enc_ticket_n_1_block, 0, $len_cleartext_last_block / 2;
# we now craft the new n-1 block
my $tmp = $b_enc_ticket_n_1_block ^ $b_cleartext_last_block_padded;

View File

@ -80,7 +80,7 @@ sub module_verify_hash
$salt =~ s/\./\+/g;
$salt .= '==';
my $new_hash = module_generate_hash ($word, decode_base64($salt), $iter);
my $new_hash = module_generate_hash ($word, decode_base64 ($salt), $iter);
return ($new_hash, $word);
}

View File

@ -80,7 +80,7 @@ sub module_verify_hash
$salt =~ s/\./\+/g;
$salt .= '==';
my $new_hash = module_generate_hash ($word, decode_base64($salt), $iter);
my $new_hash = module_generate_hash ($word, decode_base64 ($salt), $iter);
return ($new_hash, $word);
}

View File

@ -80,7 +80,7 @@ sub module_verify_hash
$salt =~ s/\./\+/g;
$salt .= '==';
my $new_hash = module_generate_hash ($word, decode_base64($salt), $iter);
my $new_hash = module_generate_hash ($word, decode_base64 ($salt), $iter);
return ($new_hash, $word);
}

View File

@ -22,13 +22,14 @@ sub module_generate_hash
$iter //= 1000;
my $digest = sha256($salt.$word);
my $digest = sha256 ($salt . $word);
for (my $i = 1; $i < $iter; $i++) {
$digest = sha256($digest);
for (my $i = 1; $i < $iter; $i++)
{
$digest = sha256 ($digest);
}
chomp($digest = encode_base64($digest));
chomp ($digest = encode_base64 ($digest));
my $hash = sprintf ("otm_sha256:%d:%s:%s", $iter, $salt, $digest);

View File

@ -9,7 +9,7 @@ use strict;
use warnings;
use Digest::MD5 qw (md5_hex);
use File::Basename qw (dirname);
use YAML::XS "LoadFile";
use YAML::XS qw (LoadFile);
use Test::More;
# Use `eq_or_diff` from Test::Differences if it's available for an easier to read comparison
@ -87,7 +87,7 @@ sub run_case_mode1
my $case = $cases{$rule};
die("Expected output for mode 1 (expected_cpu) isn't defined for rule: $rule") unless defined $case->{expected_cpu};
die ("Expected output for mode 1 (expected_cpu) isn't defined for rule: $rule") unless defined $case->{expected_cpu};
my $input_file = input_to_file ($case, $rule);
@ -105,7 +105,7 @@ sub run_case_mode2
my $case = $cases{$rule};
die("Expected output for mode 2 (expected_opencl) isn't defined for rule: $rule") unless defined $case->{expected_opencl};
die ("Expected output for mode 2 (expected_opencl) isn't defined for rule: $rule") unless defined $case->{expected_opencl};
my $input_file = input_to_file ($case, $rule);
my $rule_file = rule_to_file ($rule);
@ -177,7 +177,7 @@ sub usage_die
sub load_cases
{
my $file_path = $CURRENT_DIR . "/" . "rules-test-cases.yaml";
return %{ LoadFile($file_path) };
return %{ LoadFile ($file_path) };
}
sub cleanup