diff --git a/OpenCL/m28000_a0-optimized.cl b/OpenCL/m28000_a0-optimized.cl new file mode 100644 index 000000000..044118a69 --- /dev/null +++ b/OpenCL/m28000_a0-optimized.cl @@ -0,0 +1,390 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//incompatible because of branches +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include "inc_vendor.h" +#include "inc_types.h" +#include "inc_platform.cl" +#include "inc_common.cl" +#include "inc_rp_optimized.h" +#include "inc_rp_optimized.cl" +#include "inc_simd.cl" +#endif + +typedef struct crc64 +{ + u64 iv; + +} crc64_t; + +CONSTANT_VK u64a crc64jonestab[0x100] = +{ + 0x0000000000000000, 0x7ad870c830358979, + 0xf5b0e190606b12f2, 0x8f689158505e9b8b, + 0xc038e5739841b68f, 0xbae095bba8743ff6, + 0x358804e3f82aa47d, 0x4f50742bc81f2d04, + 0xab28ecb46814fe75, 0xd1f09c7c5821770c, + 0x5e980d24087fec87, 0x24407dec384a65fe, + 0x6b1009c7f05548fa, 0x11c8790fc060c183, + 0x9ea0e857903e5a08, 0xe478989fa00bd371, + 0x7d08ff3b88be6f81, 0x07d08ff3b88be6f8, + 0x88b81eabe8d57d73, 0xf2606e63d8e0f40a, + 0xbd301a4810ffd90e, 0xc7e86a8020ca5077, + 0x4880fbd87094cbfc, 0x32588b1040a14285, + 0xd620138fe0aa91f4, 0xacf86347d09f188d, + 0x2390f21f80c18306, 0x594882d7b0f40a7f, + 0x1618f6fc78eb277b, 0x6cc0863448deae02, + 0xe3a8176c18803589, 0x997067a428b5bcf0, + 0xfa11fe77117cdf02, 0x80c98ebf2149567b, + 0x0fa11fe77117cdf0, 0x75796f2f41224489, + 0x3a291b04893d698d, 0x40f16bccb908e0f4, + 0xcf99fa94e9567b7f, 0xb5418a5cd963f206, + 0x513912c379682177, 0x2be1620b495da80e, + 0xa489f35319033385, 0xde51839b2936bafc, + 0x9101f7b0e12997f8, 0xebd98778d11c1e81, + 0x64b116208142850a, 0x1e6966e8b1770c73, + 0x8719014c99c2b083, 0xfdc17184a9f739fa, + 0x72a9e0dcf9a9a271, 0x08719014c99c2b08, + 0x4721e43f0183060c, 0x3df994f731b68f75, + 0xb29105af61e814fe, 0xc849756751dd9d87, + 0x2c31edf8f1d64ef6, 0x56e99d30c1e3c78f, + 0xd9810c6891bd5c04, 0xa3597ca0a188d57d, + 0xec09088b6997f879, 0x96d1784359a27100, + 0x19b9e91b09fcea8b, 0x636199d339c963f2, + 0xdf7adabd7a6e2d6f, 0xa5a2aa754a5ba416, + 0x2aca3b2d1a053f9d, 0x50124be52a30b6e4, + 0x1f423fcee22f9be0, 0x659a4f06d21a1299, + 0xeaf2de5e82448912, 0x902aae96b271006b, + 0x74523609127ad31a, 0x0e8a46c1224f5a63, + 0x81e2d7997211c1e8, 0xfb3aa75142244891, + 0xb46ad37a8a3b6595, 0xceb2a3b2ba0eecec, + 0x41da32eaea507767, 0x3b024222da65fe1e, + 0xa2722586f2d042ee, 0xd8aa554ec2e5cb97, + 0x57c2c41692bb501c, 0x2d1ab4dea28ed965, + 0x624ac0f56a91f461, 0x1892b03d5aa47d18, + 0x97fa21650afae693, 0xed2251ad3acf6fea, + 0x095ac9329ac4bc9b, 0x7382b9faaaf135e2, + 0xfcea28a2faafae69, 0x8632586aca9a2710, + 0xc9622c4102850a14, 0xb3ba5c8932b0836d, + 0x3cd2cdd162ee18e6, 0x460abd1952db919f, + 0x256b24ca6b12f26d, 0x5fb354025b277b14, + 0xd0dbc55a0b79e09f, 0xaa03b5923b4c69e6, + 0xe553c1b9f35344e2, 0x9f8bb171c366cd9b, + 0x10e3202993385610, 0x6a3b50e1a30ddf69, + 0x8e43c87e03060c18, 0xf49bb8b633338561, + 0x7bf329ee636d1eea, 0x012b592653589793, + 0x4e7b2d0d9b47ba97, 0x34a35dc5ab7233ee, + 0xbbcbcc9dfb2ca865, 0xc113bc55cb19211c, + 0x5863dbf1e3ac9dec, 0x22bbab39d3991495, + 0xadd33a6183c78f1e, 0xd70b4aa9b3f20667, + 0x985b3e827bed2b63, 0xe2834e4a4bd8a21a, + 0x6debdf121b863991, 0x1733afda2bb3b0e8, + 0xf34b37458bb86399, 0x8993478dbb8deae0, + 0x06fbd6d5ebd3716b, 0x7c23a61ddbe6f812, + 0x3373d23613f9d516, 0x49aba2fe23cc5c6f, + 0xc6c333a67392c7e4, 0xbc1b436e43a74e9d, + 0x95ac9329ac4bc9b5, 0xef74e3e19c7e40cc, + 0x601c72b9cc20db47, 0x1ac40271fc15523e, + 0x5594765a340a7f3a, 0x2f4c0692043ff643, + 0xa02497ca54616dc8, 0xdafce7026454e4b1, + 0x3e847f9dc45f37c0, 0x445c0f55f46abeb9, + 0xcb349e0da4342532, 0xb1eceec59401ac4b, + 0xfebc9aee5c1e814f, 0x8464ea266c2b0836, + 0x0b0c7b7e3c7593bd, 0x71d40bb60c401ac4, + 0xe8a46c1224f5a634, 0x927c1cda14c02f4d, + 0x1d148d82449eb4c6, 0x67ccfd4a74ab3dbf, + 0x289c8961bcb410bb, 0x5244f9a98c8199c2, + 0xdd2c68f1dcdf0249, 0xa7f41839ecea8b30, + 0x438c80a64ce15841, 0x3954f06e7cd4d138, + 0xb63c61362c8a4ab3, 0xcce411fe1cbfc3ca, + 0x83b465d5d4a0eece, 0xf96c151de49567b7, + 0x76048445b4cbfc3c, 0x0cdcf48d84fe7545, + 0x6fbd6d5ebd3716b7, 0x15651d968d029fce, + 0x9a0d8ccedd5c0445, 0xe0d5fc06ed698d3c, + 0xaf85882d2576a038, 0xd55df8e515432941, + 0x5a3569bd451db2ca, 0x20ed197575283bb3, + 0xc49581ead523e8c2, 0xbe4df122e51661bb, + 0x3125607ab548fa30, 0x4bfd10b2857d7349, + 0x04ad64994d625e4d, 0x7e7514517d57d734, + 0xf11d85092d094cbf, 0x8bc5f5c11d3cc5c6, + 0x12b5926535897936, 0x686de2ad05bcf04f, + 0xe70573f555e26bc4, 0x9ddd033d65d7e2bd, + 0xd28d7716adc8cfb9, 0xa85507de9dfd46c0, + 0x273d9686cda3dd4b, 0x5de5e64efd965432, + 0xb99d7ed15d9d8743, 0xc3450e196da80e3a, + 0x4c2d9f413df695b1, 0x36f5ef890dc31cc8, + 0x79a59ba2c5dc31cc, 0x037deb6af5e9b8b5, + 0x8c157a32a5b7233e, 0xf6cd0afa9582aa47, + 0x4ad64994d625e4da, 0x300e395ce6106da3, + 0xbf66a804b64ef628, 0xc5bed8cc867b7f51, + 0x8aeeace74e645255, 0xf036dc2f7e51db2c, + 0x7f5e4d772e0f40a7, 0x05863dbf1e3ac9de, + 0xe1fea520be311aaf, 0x9b26d5e88e0493d6, + 0x144e44b0de5a085d, 0x6e963478ee6f8124, + 0x21c640532670ac20, 0x5b1e309b16452559, + 0xd476a1c3461bbed2, 0xaeaed10b762e37ab, + 0x37deb6af5e9b8b5b, 0x4d06c6676eae0222, + 0xc26e573f3ef099a9, 0xb8b627f70ec510d0, + 0xf7e653dcc6da3dd4, 0x8d3e2314f6efb4ad, + 0x0256b24ca6b12f26, 0x788ec2849684a65f, + 0x9cf65a1b368f752e, 0xe62e2ad306bafc57, + 0x6946bb8b56e467dc, 0x139ecb4366d1eea5, + 0x5ccebf68aecec3a1, 0x2616cfa09efb4ad8, + 0xa97e5ef8cea5d153, 0xd3a62e30fe90582a, + 0xb0c7b7e3c7593bd8, 0xca1fc72bf76cb2a1, + 0x45775673a732292a, 0x3faf26bb9707a053, + 0x70ff52905f188d57, 0x0a2722586f2d042e, + 0x854fb3003f739fa5, 0xff97c3c80f4616dc, + 0x1bef5b57af4dc5ad, 0x61372b9f9f784cd4, + 0xee5fbac7cf26d75f, 0x9487ca0fff135e26, + 0xdbd7be24370c7322, 0xa10fceec0739fa5b, + 0x2e675fb4576761d0, 0x54bf2f7c6752e8a9, + 0xcdcf48d84fe75459, 0xb71738107fd2dd20, + 0x387fa9482f8c46ab, 0x42a7d9801fb9cfd2, + 0x0df7adabd7a6e2d6, 0x772fdd63e7936baf, + 0xf8474c3bb7cdf024, 0x829f3cf387f8795d, + 0x66e7a46c27f3aa2c, 0x1c3fd4a417c62355, + 0x935745fc4798b8de, 0xe98f353477ad31a7, + 0xa6df411fbfb21ca3, 0xdc0731d78f8795da, + 0x536fa08fdfd90e51, 0x29b7d047efec8728, +}; + +DECLSPEC u64 round_crc64jones (u64 a, const u64 v) +{ + const u64 k = (a ^ v) & 0xff; + + const u64 s = a >> 8; + + a = crc64jonestab[k]; + + a ^= s; + + return a; +} + +DECLSPEC u64 crc64jones (const u32 *w, const u32 pw_len, const u64 iv) +{ + u64 a = iv; + + if (pw_len >= 1) a = round_crc64jones (a, w[0] >> 0); + if (pw_len >= 2) a = round_crc64jones (a, w[0] >> 8); + if (pw_len >= 3) a = round_crc64jones (a, w[0] >> 16); + if (pw_len >= 4) a = round_crc64jones (a, w[0] >> 24); + if (pw_len >= 5) a = round_crc64jones (a, w[1] >> 0); + if (pw_len >= 6) a = round_crc64jones (a, w[1] >> 8); + if (pw_len >= 7) a = round_crc64jones (a, w[1] >> 16); + if (pw_len >= 8) a = round_crc64jones (a, w[1] >> 24); + if (pw_len >= 9) a = round_crc64jones (a, w[2] >> 0); + if (pw_len >= 10) a = round_crc64jones (a, w[2] >> 8); + if (pw_len >= 11) a = round_crc64jones (a, w[2] >> 16); + if (pw_len >= 12) a = round_crc64jones (a, w[2] >> 24); + + for (u32 i = 12, j = 3; i < pw_len; i += 4, j += 1) + { + if (pw_len >= (i + 1)) a = round_crc64jones (a, w[j] >> 0); + if (pw_len >= (i + 2)) a = round_crc64jones (a, w[j] >> 8); + if (pw_len >= (i + 3)) a = round_crc64jones (a, w[j] >> 16); + if (pw_len >= (i + 4)) a = round_crc64jones (a, w[j] >> 24); + } + + return a; +} + +KERNEL_FQ void m28000_m04 (KERN_ATTR_RULES_ESALT (crc64_t)) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[ 0]; + pw_buf0[1] = pws[gid].i[ 1]; + pw_buf0[2] = pws[gid].i[ 2]; + pw_buf0[3] = pws[gid].i[ 3]; + pw_buf1[0] = pws[gid].i[ 4]; + pw_buf1[1] = pws[gid].i[ 5]; + pw_buf1[2] = pws[gid].i[ 6]; + pw_buf1[3] = pws[gid].i[ 7]; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * salt + */ + + const u64 iv = esalt_bufs[DIGESTS_OFFSET].iv; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + u32 w0[4] = { 0 }; + u32 w1[4] = { 0 }; + u32 w2[4] = { 0 }; + u32 w3[4] = { 0 }; + + const u32 out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); + + /** + * crc32c + */ + + u32 w[16]; + + w[ 0] = w0[0]; + w[ 1] = w0[1]; + w[ 2] = w0[2]; + w[ 3] = w0[3]; + w[ 4] = w1[0]; + w[ 5] = w1[1]; + w[ 6] = w1[2]; + w[ 7] = w1[3]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + u64 a = crc64jones (w, pw_len, iv); + + const u32 r0 = l32_from_64 (a); + const u32 r1 = h32_from_64 (a); + const u32 r2 = 0; + const u32 r3 = 0; + + COMPARE_M_SIMD (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m28000_m08 (KERN_ATTR_RULES_ESALT (crc64_t)) +{ +} + +KERNEL_FQ void m28000_m16 (KERN_ATTR_RULES_ESALT (crc64_t)) +{ +} + +KERNEL_FQ void m28000_s04 (KERN_ATTR_RULES_ESALT (crc64_t)) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[ 0]; + pw_buf0[1] = pws[gid].i[ 1]; + pw_buf0[2] = pws[gid].i[ 2]; + pw_buf0[3] = pws[gid].i[ 3]; + pw_buf1[0] = pws[gid].i[ 4]; + pw_buf1[1] = pws[gid].i[ 5]; + pw_buf1[2] = pws[gid].i[ 6]; + pw_buf1[3] = pws[gid].i[ 7]; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * salt + */ + + const u64 iv = esalt_bufs[DIGESTS_OFFSET].iv; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + u32 w0[4] = { 0 }; + u32 w1[4] = { 0 }; + u32 w2[4] = { 0 }; + u32 w3[4] = { 0 }; + + const u32 out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); + + /** + * crc32c + */ + + u32 w[16]; + + w[ 0] = w0[0]; + w[ 1] = w0[1]; + w[ 2] = w0[2]; + w[ 3] = w0[3]; + w[ 4] = w1[0]; + w[ 5] = w1[1]; + w[ 6] = w1[2]; + w[ 7] = w1[3]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + u64 a = crc64jones (w, pw_len, iv); + + const u32 r0 = l32_from_64 (a); + const u32 r1 = h32_from_64 (a); + const u32 r2 = 0; + const u32 r3 = 0; + + COMPARE_S_SIMD (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m28000_s08 (KERN_ATTR_RULES_ESALT (crc64_t)) +{ +} + +KERNEL_FQ void m28000_s16 (KERN_ATTR_RULES_ESALT (crc64_t)) +{ +} diff --git a/OpenCL/m28000_a1-optimized.cl b/OpenCL/m28000_a1-optimized.cl new file mode 100644 index 000000000..92f5979e5 --- /dev/null +++ b/OpenCL/m28000_a1-optimized.cl @@ -0,0 +1,508 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//incompatible because of branches +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include "inc_vendor.h" +#include "inc_types.h" +#include "inc_platform.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#endif + +typedef struct crc64 +{ + u64 iv; + +} crc64_t; + +CONSTANT_VK u64a crc64jonestab[0x100] = +{ + 0x0000000000000000, 0x7ad870c830358979, + 0xf5b0e190606b12f2, 0x8f689158505e9b8b, + 0xc038e5739841b68f, 0xbae095bba8743ff6, + 0x358804e3f82aa47d, 0x4f50742bc81f2d04, + 0xab28ecb46814fe75, 0xd1f09c7c5821770c, + 0x5e980d24087fec87, 0x24407dec384a65fe, + 0x6b1009c7f05548fa, 0x11c8790fc060c183, + 0x9ea0e857903e5a08, 0xe478989fa00bd371, + 0x7d08ff3b88be6f81, 0x07d08ff3b88be6f8, + 0x88b81eabe8d57d73, 0xf2606e63d8e0f40a, + 0xbd301a4810ffd90e, 0xc7e86a8020ca5077, + 0x4880fbd87094cbfc, 0x32588b1040a14285, + 0xd620138fe0aa91f4, 0xacf86347d09f188d, + 0x2390f21f80c18306, 0x594882d7b0f40a7f, + 0x1618f6fc78eb277b, 0x6cc0863448deae02, + 0xe3a8176c18803589, 0x997067a428b5bcf0, + 0xfa11fe77117cdf02, 0x80c98ebf2149567b, + 0x0fa11fe77117cdf0, 0x75796f2f41224489, + 0x3a291b04893d698d, 0x40f16bccb908e0f4, + 0xcf99fa94e9567b7f, 0xb5418a5cd963f206, + 0x513912c379682177, 0x2be1620b495da80e, + 0xa489f35319033385, 0xde51839b2936bafc, + 0x9101f7b0e12997f8, 0xebd98778d11c1e81, + 0x64b116208142850a, 0x1e6966e8b1770c73, + 0x8719014c99c2b083, 0xfdc17184a9f739fa, + 0x72a9e0dcf9a9a271, 0x08719014c99c2b08, + 0x4721e43f0183060c, 0x3df994f731b68f75, + 0xb29105af61e814fe, 0xc849756751dd9d87, + 0x2c31edf8f1d64ef6, 0x56e99d30c1e3c78f, + 0xd9810c6891bd5c04, 0xa3597ca0a188d57d, + 0xec09088b6997f879, 0x96d1784359a27100, + 0x19b9e91b09fcea8b, 0x636199d339c963f2, + 0xdf7adabd7a6e2d6f, 0xa5a2aa754a5ba416, + 0x2aca3b2d1a053f9d, 0x50124be52a30b6e4, + 0x1f423fcee22f9be0, 0x659a4f06d21a1299, + 0xeaf2de5e82448912, 0x902aae96b271006b, + 0x74523609127ad31a, 0x0e8a46c1224f5a63, + 0x81e2d7997211c1e8, 0xfb3aa75142244891, + 0xb46ad37a8a3b6595, 0xceb2a3b2ba0eecec, + 0x41da32eaea507767, 0x3b024222da65fe1e, + 0xa2722586f2d042ee, 0xd8aa554ec2e5cb97, + 0x57c2c41692bb501c, 0x2d1ab4dea28ed965, + 0x624ac0f56a91f461, 0x1892b03d5aa47d18, + 0x97fa21650afae693, 0xed2251ad3acf6fea, + 0x095ac9329ac4bc9b, 0x7382b9faaaf135e2, + 0xfcea28a2faafae69, 0x8632586aca9a2710, + 0xc9622c4102850a14, 0xb3ba5c8932b0836d, + 0x3cd2cdd162ee18e6, 0x460abd1952db919f, + 0x256b24ca6b12f26d, 0x5fb354025b277b14, + 0xd0dbc55a0b79e09f, 0xaa03b5923b4c69e6, + 0xe553c1b9f35344e2, 0x9f8bb171c366cd9b, + 0x10e3202993385610, 0x6a3b50e1a30ddf69, + 0x8e43c87e03060c18, 0xf49bb8b633338561, + 0x7bf329ee636d1eea, 0x012b592653589793, + 0x4e7b2d0d9b47ba97, 0x34a35dc5ab7233ee, + 0xbbcbcc9dfb2ca865, 0xc113bc55cb19211c, + 0x5863dbf1e3ac9dec, 0x22bbab39d3991495, + 0xadd33a6183c78f1e, 0xd70b4aa9b3f20667, + 0x985b3e827bed2b63, 0xe2834e4a4bd8a21a, + 0x6debdf121b863991, 0x1733afda2bb3b0e8, + 0xf34b37458bb86399, 0x8993478dbb8deae0, + 0x06fbd6d5ebd3716b, 0x7c23a61ddbe6f812, + 0x3373d23613f9d516, 0x49aba2fe23cc5c6f, + 0xc6c333a67392c7e4, 0xbc1b436e43a74e9d, + 0x95ac9329ac4bc9b5, 0xef74e3e19c7e40cc, + 0x601c72b9cc20db47, 0x1ac40271fc15523e, + 0x5594765a340a7f3a, 0x2f4c0692043ff643, + 0xa02497ca54616dc8, 0xdafce7026454e4b1, + 0x3e847f9dc45f37c0, 0x445c0f55f46abeb9, + 0xcb349e0da4342532, 0xb1eceec59401ac4b, + 0xfebc9aee5c1e814f, 0x8464ea266c2b0836, + 0x0b0c7b7e3c7593bd, 0x71d40bb60c401ac4, + 0xe8a46c1224f5a634, 0x927c1cda14c02f4d, + 0x1d148d82449eb4c6, 0x67ccfd4a74ab3dbf, + 0x289c8961bcb410bb, 0x5244f9a98c8199c2, + 0xdd2c68f1dcdf0249, 0xa7f41839ecea8b30, + 0x438c80a64ce15841, 0x3954f06e7cd4d138, + 0xb63c61362c8a4ab3, 0xcce411fe1cbfc3ca, + 0x83b465d5d4a0eece, 0xf96c151de49567b7, + 0x76048445b4cbfc3c, 0x0cdcf48d84fe7545, + 0x6fbd6d5ebd3716b7, 0x15651d968d029fce, + 0x9a0d8ccedd5c0445, 0xe0d5fc06ed698d3c, + 0xaf85882d2576a038, 0xd55df8e515432941, + 0x5a3569bd451db2ca, 0x20ed197575283bb3, + 0xc49581ead523e8c2, 0xbe4df122e51661bb, + 0x3125607ab548fa30, 0x4bfd10b2857d7349, + 0x04ad64994d625e4d, 0x7e7514517d57d734, + 0xf11d85092d094cbf, 0x8bc5f5c11d3cc5c6, + 0x12b5926535897936, 0x686de2ad05bcf04f, + 0xe70573f555e26bc4, 0x9ddd033d65d7e2bd, + 0xd28d7716adc8cfb9, 0xa85507de9dfd46c0, + 0x273d9686cda3dd4b, 0x5de5e64efd965432, + 0xb99d7ed15d9d8743, 0xc3450e196da80e3a, + 0x4c2d9f413df695b1, 0x36f5ef890dc31cc8, + 0x79a59ba2c5dc31cc, 0x037deb6af5e9b8b5, + 0x8c157a32a5b7233e, 0xf6cd0afa9582aa47, + 0x4ad64994d625e4da, 0x300e395ce6106da3, + 0xbf66a804b64ef628, 0xc5bed8cc867b7f51, + 0x8aeeace74e645255, 0xf036dc2f7e51db2c, + 0x7f5e4d772e0f40a7, 0x05863dbf1e3ac9de, + 0xe1fea520be311aaf, 0x9b26d5e88e0493d6, + 0x144e44b0de5a085d, 0x6e963478ee6f8124, + 0x21c640532670ac20, 0x5b1e309b16452559, + 0xd476a1c3461bbed2, 0xaeaed10b762e37ab, + 0x37deb6af5e9b8b5b, 0x4d06c6676eae0222, + 0xc26e573f3ef099a9, 0xb8b627f70ec510d0, + 0xf7e653dcc6da3dd4, 0x8d3e2314f6efb4ad, + 0x0256b24ca6b12f26, 0x788ec2849684a65f, + 0x9cf65a1b368f752e, 0xe62e2ad306bafc57, + 0x6946bb8b56e467dc, 0x139ecb4366d1eea5, + 0x5ccebf68aecec3a1, 0x2616cfa09efb4ad8, + 0xa97e5ef8cea5d153, 0xd3a62e30fe90582a, + 0xb0c7b7e3c7593bd8, 0xca1fc72bf76cb2a1, + 0x45775673a732292a, 0x3faf26bb9707a053, + 0x70ff52905f188d57, 0x0a2722586f2d042e, + 0x854fb3003f739fa5, 0xff97c3c80f4616dc, + 0x1bef5b57af4dc5ad, 0x61372b9f9f784cd4, + 0xee5fbac7cf26d75f, 0x9487ca0fff135e26, + 0xdbd7be24370c7322, 0xa10fceec0739fa5b, + 0x2e675fb4576761d0, 0x54bf2f7c6752e8a9, + 0xcdcf48d84fe75459, 0xb71738107fd2dd20, + 0x387fa9482f8c46ab, 0x42a7d9801fb9cfd2, + 0x0df7adabd7a6e2d6, 0x772fdd63e7936baf, + 0xf8474c3bb7cdf024, 0x829f3cf387f8795d, + 0x66e7a46c27f3aa2c, 0x1c3fd4a417c62355, + 0x935745fc4798b8de, 0xe98f353477ad31a7, + 0xa6df411fbfb21ca3, 0xdc0731d78f8795da, + 0x536fa08fdfd90e51, 0x29b7d047efec8728, +}; + +DECLSPEC u64 round_crc64jones (u64 a, const u64 v) +{ + const u64 k = (a ^ v) & 0xff; + + const u64 s = a >> 8; + + a = crc64jonestab[k]; + + a ^= s; + + return a; +} + +DECLSPEC u64 crc64jones (const u32 *w, const u32 pw_len, const u64 iv) +{ + u64 a = iv; + + if (pw_len >= 1) a = round_crc64jones (a, w[0] >> 0); + if (pw_len >= 2) a = round_crc64jones (a, w[0] >> 8); + if (pw_len >= 3) a = round_crc64jones (a, w[0] >> 16); + if (pw_len >= 4) a = round_crc64jones (a, w[0] >> 24); + if (pw_len >= 5) a = round_crc64jones (a, w[1] >> 0); + if (pw_len >= 6) a = round_crc64jones (a, w[1] >> 8); + if (pw_len >= 7) a = round_crc64jones (a, w[1] >> 16); + if (pw_len >= 8) a = round_crc64jones (a, w[1] >> 24); + if (pw_len >= 9) a = round_crc64jones (a, w[2] >> 0); + if (pw_len >= 10) a = round_crc64jones (a, w[2] >> 8); + if (pw_len >= 11) a = round_crc64jones (a, w[2] >> 16); + if (pw_len >= 12) a = round_crc64jones (a, w[2] >> 24); + + for (u32 i = 12, j = 3; i < pw_len; i += 4, j += 1) + { + if (pw_len >= (i + 1)) a = round_crc64jones (a, w[j] >> 0); + if (pw_len >= (i + 2)) a = round_crc64jones (a, w[j] >> 8); + if (pw_len >= (i + 3)) a = round_crc64jones (a, w[j] >> 16); + if (pw_len >= (i + 4)) a = round_crc64jones (a, w[j] >> 24); + } + + return a; +} + +KERNEL_FQ void m28000_m04 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len & 63; + + /** + * salt + */ + + const u64 iv = esalt_bufs[DIGESTS_OFFSET].iv; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63; + + const u32 pw_len = (pw_l_len + pw_r_len) & 63; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (combs_mode == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = wordl0[0] | wordr0[0]; + w0[1] = wordl0[1] | wordr0[1]; + w0[2] = wordl0[2] | wordr0[2]; + w0[3] = wordl0[3] | wordr0[3]; + w1[0] = wordl1[0] | wordr1[0]; + w1[1] = wordl1[1] | wordr1[1]; + w1[2] = wordl1[2] | wordr1[2]; + w1[3] = wordl1[3] | wordr1[3]; + w2[0] = wordl2[0] | wordr2[0]; + w2[1] = wordl2[1] | wordr2[1]; + w2[2] = wordl2[2] | wordr2[2]; + w2[3] = wordl2[3] | wordr2[3]; + w3[0] = wordl3[0] | wordr3[0]; + w3[1] = wordl3[1] | wordr3[1]; + w3[2] = wordl3[2] | wordr3[2]; + w3[3] = wordl3[3] | wordr3[3]; + + /** + * crc32c + */ + + u32 w[16]; + + w[ 0] = w0[0]; + w[ 1] = w0[1]; + w[ 2] = w0[2]; + w[ 3] = w0[3]; + w[ 4] = w1[0]; + w[ 5] = w1[1]; + w[ 6] = w1[2]; + w[ 7] = w1[3]; + w[ 8] = w2[0]; + w[ 9] = w2[1]; + w[10] = w2[2]; + w[11] = w2[3]; + w[12] = w3[0]; + w[13] = w3[1]; + w[14] = w3[2]; + w[15] = w3[3]; + + u64 a = crc64jones (w, pw_len, iv); + + const u32 r0 = l32_from_64 (a); + const u32 r1 = h32_from_64 (a); + const u32 r2 = 0; + const u32 r3 = 0; + + COMPARE_M_SIMD (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m28000_m08 (KERN_ATTR_ESALT (crc64_t)) +{ +} + +KERNEL_FQ void m28000_m16 (KERN_ATTR_ESALT (crc64_t)) +{ +} + +KERNEL_FQ void m28000_s04 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len & 63; + + /** + * salt + */ + + const u64 iv = esalt_bufs[DIGESTS_OFFSET].iv; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63; + + const u32 pw_len = (pw_l_len + pw_r_len) & 63; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (combs_mode == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = wordl0[0] | wordr0[0]; + w0[1] = wordl0[1] | wordr0[1]; + w0[2] = wordl0[2] | wordr0[2]; + w0[3] = wordl0[3] | wordr0[3]; + w1[0] = wordl1[0] | wordr1[0]; + w1[1] = wordl1[1] | wordr1[1]; + w1[2] = wordl1[2] | wordr1[2]; + w1[3] = wordl1[3] | wordr1[3]; + w2[0] = wordl2[0] | wordr2[0]; + w2[1] = wordl2[1] | wordr2[1]; + w2[2] = wordl2[2] | wordr2[2]; + w2[3] = wordl2[3] | wordr2[3]; + w3[0] = wordl3[0] | wordr3[0]; + w3[1] = wordl3[1] | wordr3[1]; + w3[2] = wordl3[2] | wordr3[2]; + w3[3] = wordl3[3] | wordr3[3]; + + /** + * crc32c + */ + + u32 w[16]; + + w[ 0] = w0[0]; + w[ 1] = w0[1]; + w[ 2] = w0[2]; + w[ 3] = w0[3]; + w[ 4] = w1[0]; + w[ 5] = w1[1]; + w[ 6] = w1[2]; + w[ 7] = w1[3]; + w[ 8] = w2[0]; + w[ 9] = w2[1]; + w[10] = w2[2]; + w[11] = w2[3]; + w[12] = w3[0]; + w[13] = w3[1]; + w[14] = w3[2]; + w[15] = w3[3]; + + u64 a = crc64jones (w, pw_len, iv); + + const u32 r0 = l32_from_64 (a); + const u32 r1 = h32_from_64 (a); + const u32 r2 = 0; + const u32 r3 = 0; + + COMPARE_S_SIMD (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m28000_s08 (KERN_ATTR_ESALT (crc64_t)) +{ +} + +KERNEL_FQ void m28000_s16 (KERN_ATTR_ESALT (crc64_t)) +{ +} diff --git a/OpenCL/m28000_a3-optimized.cl b/OpenCL/m28000_a3-optimized.cl new file mode 100644 index 000000000..a2a218f8c --- /dev/null +++ b/OpenCL/m28000_a3-optimized.cl @@ -0,0 +1,556 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//incompatible because of branches +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include "inc_vendor.h" +#include "inc_types.h" +#include "inc_platform.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#endif + +typedef struct crc64 +{ + u64 iv; + +} crc64_t; + +CONSTANT_VK u64a crc64jonestab[0x100] = +{ + 0x0000000000000000, 0x7ad870c830358979, + 0xf5b0e190606b12f2, 0x8f689158505e9b8b, + 0xc038e5739841b68f, 0xbae095bba8743ff6, + 0x358804e3f82aa47d, 0x4f50742bc81f2d04, + 0xab28ecb46814fe75, 0xd1f09c7c5821770c, + 0x5e980d24087fec87, 0x24407dec384a65fe, + 0x6b1009c7f05548fa, 0x11c8790fc060c183, + 0x9ea0e857903e5a08, 0xe478989fa00bd371, + 0x7d08ff3b88be6f81, 0x07d08ff3b88be6f8, + 0x88b81eabe8d57d73, 0xf2606e63d8e0f40a, + 0xbd301a4810ffd90e, 0xc7e86a8020ca5077, + 0x4880fbd87094cbfc, 0x32588b1040a14285, + 0xd620138fe0aa91f4, 0xacf86347d09f188d, + 0x2390f21f80c18306, 0x594882d7b0f40a7f, + 0x1618f6fc78eb277b, 0x6cc0863448deae02, + 0xe3a8176c18803589, 0x997067a428b5bcf0, + 0xfa11fe77117cdf02, 0x80c98ebf2149567b, + 0x0fa11fe77117cdf0, 0x75796f2f41224489, + 0x3a291b04893d698d, 0x40f16bccb908e0f4, + 0xcf99fa94e9567b7f, 0xb5418a5cd963f206, + 0x513912c379682177, 0x2be1620b495da80e, + 0xa489f35319033385, 0xde51839b2936bafc, + 0x9101f7b0e12997f8, 0xebd98778d11c1e81, + 0x64b116208142850a, 0x1e6966e8b1770c73, + 0x8719014c99c2b083, 0xfdc17184a9f739fa, + 0x72a9e0dcf9a9a271, 0x08719014c99c2b08, + 0x4721e43f0183060c, 0x3df994f731b68f75, + 0xb29105af61e814fe, 0xc849756751dd9d87, + 0x2c31edf8f1d64ef6, 0x56e99d30c1e3c78f, + 0xd9810c6891bd5c04, 0xa3597ca0a188d57d, + 0xec09088b6997f879, 0x96d1784359a27100, + 0x19b9e91b09fcea8b, 0x636199d339c963f2, + 0xdf7adabd7a6e2d6f, 0xa5a2aa754a5ba416, + 0x2aca3b2d1a053f9d, 0x50124be52a30b6e4, + 0x1f423fcee22f9be0, 0x659a4f06d21a1299, + 0xeaf2de5e82448912, 0x902aae96b271006b, + 0x74523609127ad31a, 0x0e8a46c1224f5a63, + 0x81e2d7997211c1e8, 0xfb3aa75142244891, + 0xb46ad37a8a3b6595, 0xceb2a3b2ba0eecec, + 0x41da32eaea507767, 0x3b024222da65fe1e, + 0xa2722586f2d042ee, 0xd8aa554ec2e5cb97, + 0x57c2c41692bb501c, 0x2d1ab4dea28ed965, + 0x624ac0f56a91f461, 0x1892b03d5aa47d18, + 0x97fa21650afae693, 0xed2251ad3acf6fea, + 0x095ac9329ac4bc9b, 0x7382b9faaaf135e2, + 0xfcea28a2faafae69, 0x8632586aca9a2710, + 0xc9622c4102850a14, 0xb3ba5c8932b0836d, + 0x3cd2cdd162ee18e6, 0x460abd1952db919f, + 0x256b24ca6b12f26d, 0x5fb354025b277b14, + 0xd0dbc55a0b79e09f, 0xaa03b5923b4c69e6, + 0xe553c1b9f35344e2, 0x9f8bb171c366cd9b, + 0x10e3202993385610, 0x6a3b50e1a30ddf69, + 0x8e43c87e03060c18, 0xf49bb8b633338561, + 0x7bf329ee636d1eea, 0x012b592653589793, + 0x4e7b2d0d9b47ba97, 0x34a35dc5ab7233ee, + 0xbbcbcc9dfb2ca865, 0xc113bc55cb19211c, + 0x5863dbf1e3ac9dec, 0x22bbab39d3991495, + 0xadd33a6183c78f1e, 0xd70b4aa9b3f20667, + 0x985b3e827bed2b63, 0xe2834e4a4bd8a21a, + 0x6debdf121b863991, 0x1733afda2bb3b0e8, + 0xf34b37458bb86399, 0x8993478dbb8deae0, + 0x06fbd6d5ebd3716b, 0x7c23a61ddbe6f812, + 0x3373d23613f9d516, 0x49aba2fe23cc5c6f, + 0xc6c333a67392c7e4, 0xbc1b436e43a74e9d, + 0x95ac9329ac4bc9b5, 0xef74e3e19c7e40cc, + 0x601c72b9cc20db47, 0x1ac40271fc15523e, + 0x5594765a340a7f3a, 0x2f4c0692043ff643, + 0xa02497ca54616dc8, 0xdafce7026454e4b1, + 0x3e847f9dc45f37c0, 0x445c0f55f46abeb9, + 0xcb349e0da4342532, 0xb1eceec59401ac4b, + 0xfebc9aee5c1e814f, 0x8464ea266c2b0836, + 0x0b0c7b7e3c7593bd, 0x71d40bb60c401ac4, + 0xe8a46c1224f5a634, 0x927c1cda14c02f4d, + 0x1d148d82449eb4c6, 0x67ccfd4a74ab3dbf, + 0x289c8961bcb410bb, 0x5244f9a98c8199c2, + 0xdd2c68f1dcdf0249, 0xa7f41839ecea8b30, + 0x438c80a64ce15841, 0x3954f06e7cd4d138, + 0xb63c61362c8a4ab3, 0xcce411fe1cbfc3ca, + 0x83b465d5d4a0eece, 0xf96c151de49567b7, + 0x76048445b4cbfc3c, 0x0cdcf48d84fe7545, + 0x6fbd6d5ebd3716b7, 0x15651d968d029fce, + 0x9a0d8ccedd5c0445, 0xe0d5fc06ed698d3c, + 0xaf85882d2576a038, 0xd55df8e515432941, + 0x5a3569bd451db2ca, 0x20ed197575283bb3, + 0xc49581ead523e8c2, 0xbe4df122e51661bb, + 0x3125607ab548fa30, 0x4bfd10b2857d7349, + 0x04ad64994d625e4d, 0x7e7514517d57d734, + 0xf11d85092d094cbf, 0x8bc5f5c11d3cc5c6, + 0x12b5926535897936, 0x686de2ad05bcf04f, + 0xe70573f555e26bc4, 0x9ddd033d65d7e2bd, + 0xd28d7716adc8cfb9, 0xa85507de9dfd46c0, + 0x273d9686cda3dd4b, 0x5de5e64efd965432, + 0xb99d7ed15d9d8743, 0xc3450e196da80e3a, + 0x4c2d9f413df695b1, 0x36f5ef890dc31cc8, + 0x79a59ba2c5dc31cc, 0x037deb6af5e9b8b5, + 0x8c157a32a5b7233e, 0xf6cd0afa9582aa47, + 0x4ad64994d625e4da, 0x300e395ce6106da3, + 0xbf66a804b64ef628, 0xc5bed8cc867b7f51, + 0x8aeeace74e645255, 0xf036dc2f7e51db2c, + 0x7f5e4d772e0f40a7, 0x05863dbf1e3ac9de, + 0xe1fea520be311aaf, 0x9b26d5e88e0493d6, + 0x144e44b0de5a085d, 0x6e963478ee6f8124, + 0x21c640532670ac20, 0x5b1e309b16452559, + 0xd476a1c3461bbed2, 0xaeaed10b762e37ab, + 0x37deb6af5e9b8b5b, 0x4d06c6676eae0222, + 0xc26e573f3ef099a9, 0xb8b627f70ec510d0, + 0xf7e653dcc6da3dd4, 0x8d3e2314f6efb4ad, + 0x0256b24ca6b12f26, 0x788ec2849684a65f, + 0x9cf65a1b368f752e, 0xe62e2ad306bafc57, + 0x6946bb8b56e467dc, 0x139ecb4366d1eea5, + 0x5ccebf68aecec3a1, 0x2616cfa09efb4ad8, + 0xa97e5ef8cea5d153, 0xd3a62e30fe90582a, + 0xb0c7b7e3c7593bd8, 0xca1fc72bf76cb2a1, + 0x45775673a732292a, 0x3faf26bb9707a053, + 0x70ff52905f188d57, 0x0a2722586f2d042e, + 0x854fb3003f739fa5, 0xff97c3c80f4616dc, + 0x1bef5b57af4dc5ad, 0x61372b9f9f784cd4, + 0xee5fbac7cf26d75f, 0x9487ca0fff135e26, + 0xdbd7be24370c7322, 0xa10fceec0739fa5b, + 0x2e675fb4576761d0, 0x54bf2f7c6752e8a9, + 0xcdcf48d84fe75459, 0xb71738107fd2dd20, + 0x387fa9482f8c46ab, 0x42a7d9801fb9cfd2, + 0x0df7adabd7a6e2d6, 0x772fdd63e7936baf, + 0xf8474c3bb7cdf024, 0x829f3cf387f8795d, + 0x66e7a46c27f3aa2c, 0x1c3fd4a417c62355, + 0x935745fc4798b8de, 0xe98f353477ad31a7, + 0xa6df411fbfb21ca3, 0xdc0731d78f8795da, + 0x536fa08fdfd90e51, 0x29b7d047efec8728, +}; + +DECLSPEC u64 round_crc64jones (u64 a, const u64 v) +{ + const u64 k = (a ^ v) & 0xff; + + const u64 s = a >> 8; + + a = crc64jonestab[k]; + + a ^= s; + + return a; +} + +DECLSPEC u64 crc64jones (const u32 *w, const u32 pw_len, const u64 iv) +{ + u64 a = iv; + + if (pw_len >= 1) a = round_crc64jones (a, w[0] >> 0); + if (pw_len >= 2) a = round_crc64jones (a, w[0] >> 8); + if (pw_len >= 3) a = round_crc64jones (a, w[0] >> 16); + if (pw_len >= 4) a = round_crc64jones (a, w[0] >> 24); + if (pw_len >= 5) a = round_crc64jones (a, w[1] >> 0); + if (pw_len >= 6) a = round_crc64jones (a, w[1] >> 8); + if (pw_len >= 7) a = round_crc64jones (a, w[1] >> 16); + if (pw_len >= 8) a = round_crc64jones (a, w[1] >> 24); + if (pw_len >= 9) a = round_crc64jones (a, w[2] >> 0); + if (pw_len >= 10) a = round_crc64jones (a, w[2] >> 8); + if (pw_len >= 11) a = round_crc64jones (a, w[2] >> 16); + if (pw_len >= 12) a = round_crc64jones (a, w[2] >> 24); + + for (u32 i = 12, j = 3; i < pw_len; i += 4, j += 1) + { + if (pw_len >= (i + 1)) a = round_crc64jones (a, w[j] >> 0); + if (pw_len >= (i + 2)) a = round_crc64jones (a, w[j] >> 8); + if (pw_len >= (i + 3)) a = round_crc64jones (a, w[j] >> 16); + if (pw_len >= (i + 4)) a = round_crc64jones (a, w[j] >> 24); + } + + return a; +} + +DECLSPEC void m28000m (u32 *w, const u32 pw_len, KERN_ATTR_ESALT (crc64_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + /** + * salt + */ + + const u64 iv = esalt_bufs[DIGESTS_OFFSET].iv; + + /** + * loop + */ + + u32 w0l = w[0]; + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32 w0r = ix_create_bft (bfs_buf, il_pos); + + const u32 w0 = w0l | w0r; + + /** + * crc32c + */ + + u32 w_t[16]; + + w_t[ 0] = w0; + w_t[ 1] = w[ 1]; + w_t[ 2] = w[ 2]; + w_t[ 3] = w[ 3]; + w_t[ 4] = w[ 4]; + w_t[ 5] = w[ 5]; + w_t[ 6] = w[ 6]; + w_t[ 7] = w[ 7]; + w_t[ 8] = w[ 8]; + w_t[ 9] = w[ 9]; + w_t[10] = w[10]; + w_t[11] = w[11]; + w_t[12] = w[12]; + w_t[13] = w[13]; + w_t[14] = w[14]; + w_t[15] = w[15]; + + u64 a = crc64jones (w_t, pw_len, iv); + + const u32 r0 = l32_from_64 (a); + const u32 r1 = h32_from_64 (a); + const u32 r2 = 0; + const u32 r3 = 0; + + COMPARE_M_SIMD (r0, r1, r2, r3); + } +} + +DECLSPEC void m28000s (u32 *w, const u32 pw_len, KERN_ATTR_ESALT (crc64_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + /** + * salt + */ + + const u64 iv = esalt_bufs[DIGESTS_OFFSET].iv; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + u32 w0l = w[0]; + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32 w0r = ix_create_bft (bfs_buf, il_pos); + + const u32 w0 = w0l | w0r; + + /** + * crc32c + */ + + u32 w_t[16]; + + w_t[ 0] = w0; + w_t[ 1] = w[ 1]; + w_t[ 2] = w[ 2]; + w_t[ 3] = w[ 3]; + w_t[ 4] = w[ 4]; + w_t[ 5] = w[ 5]; + w_t[ 6] = w[ 6]; + w_t[ 7] = w[ 7]; + w_t[ 8] = w[ 8]; + w_t[ 9] = w[ 9]; + w_t[10] = w[10]; + w_t[11] = w[11]; + w_t[12] = w[12]; + w_t[13] = w[13]; + w_t[14] = w[14]; + w_t[15] = w[15]; + + u64 a = crc64jones (w_t, pw_len, iv); + + const u32 r0 = l32_from_64 (a); + const u32 r1 = h32_from_64 (a); + const u32 r2 = 0; + const u32 r3 = 0; + + COMPARE_S_SIMD (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m28000_m04 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m28000m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max); +} + +KERNEL_FQ void m28000_m08 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m28000m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max); +} + +KERNEL_FQ void m28000_m16 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m28000m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max); +} + +KERNEL_FQ void m28000_s04 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m28000s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max); +} + +KERNEL_FQ void m28000_s08 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m28000s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max); +} + +KERNEL_FQ void m28000_s16 (KERN_ATTR_ESALT (crc64_t)) +{ + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m28000s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max); +} diff --git a/docs/changes.txt b/docs/changes.txt index 2964cdcf7..5f9204b09 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -5,6 +5,7 @@ ## - Added hash-mode: CRC32C +- Added hash-mode: CRC64Jones - Added hash-mode: MultiBit Classic .wallet (scrypt) - Added hash-mode: MurmurHash3 diff --git a/docs/readme.txt b/docs/readme.txt index d8aa7b670..991cf2f72 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -136,6 +136,7 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or - HMAC-Streebog-512 (key = $salt), big-endian - CRC32 - CRC32C +- CRC64Jones - Java Object hashCode() - MurmurHash - MurmurHash3 diff --git a/src/modules/module_28000.c b/src/modules/module_28000.c new file mode 100644 index 000000000..62c22cfda --- /dev/null +++ b/src/modules/module_28000.c @@ -0,0 +1,203 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CHECKSUM; +static const char *HASH_NAME = "CRC64Jones"; +static const u64 KERN_TYPE = 28000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "65c1f848fe38cce6:4260950400318054"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct crc64 +{ + u64 iv; + +} crc64_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (crc64_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + crc64_t *crc64 = (crc64_t *) esalt_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = hashconfig->separator; + token.len_min[1] = 16; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos); + digest[1] = 0; + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = 0; + + const u8 *salt_pos = token.buf[1]; + + crc64->iv = hex_to_u64 (salt_pos); + + crc64->iv = byte_swap_64 (crc64->iv); + + salt->salt_buf[0] = (crc64->iv >> 0) & 0xffffffff; + salt->salt_buf[1] = (crc64->iv >> 32) & 0xffffffff; + + salt->salt_len = 8; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + crc64_t *crc64 = (crc64_t *) esalt_buf; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (byte_swap_64 (digest[0]), out_buf + out_len); out_len += 16; + + out_buf[out_len] = (u8) hashconfig->separator; + + out_len += 1; + + u64_to_hex (byte_swap_64 (crc64->iv), out_buf + out_len); out_len += 16; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_deprecated_notice = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/tools/test_modules/m28000.pm b/tools/test_modules/m28000.pm new file mode 100644 index 000000000..fcbf09dbf --- /dev/null +++ b/tools/test_modules/m28000.pm @@ -0,0 +1,193 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; +use Math::BigInt; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [16, 16], [-1, -1]] } + +my @tbl = +( + Math::BigInt->new ("0x" . "0000000000000000"), Math::BigInt->new ("0x" . "7ad870c830358979"), + Math::BigInt->new ("0x" . "f5b0e190606b12f2"), Math::BigInt->new ("0x" . "8f689158505e9b8b"), + Math::BigInt->new ("0x" . "c038e5739841b68f"), Math::BigInt->new ("0x" . "bae095bba8743ff6"), + Math::BigInt->new ("0x" . "358804e3f82aa47d"), Math::BigInt->new ("0x" . "4f50742bc81f2d04"), + Math::BigInt->new ("0x" . "ab28ecb46814fe75"), Math::BigInt->new ("0x" . "d1f09c7c5821770c"), + Math::BigInt->new ("0x" . "5e980d24087fec87"), Math::BigInt->new ("0x" . "24407dec384a65fe"), + Math::BigInt->new ("0x" . "6b1009c7f05548fa"), Math::BigInt->new ("0x" . "11c8790fc060c183"), + Math::BigInt->new ("0x" . "9ea0e857903e5a08"), Math::BigInt->new ("0x" . "e478989fa00bd371"), + Math::BigInt->new ("0x" . "7d08ff3b88be6f81"), Math::BigInt->new ("0x" . "07d08ff3b88be6f8"), + Math::BigInt->new ("0x" . "88b81eabe8d57d73"), Math::BigInt->new ("0x" . "f2606e63d8e0f40a"), + Math::BigInt->new ("0x" . "bd301a4810ffd90e"), Math::BigInt->new ("0x" . "c7e86a8020ca5077"), + Math::BigInt->new ("0x" . "4880fbd87094cbfc"), Math::BigInt->new ("0x" . "32588b1040a14285"), + Math::BigInt->new ("0x" . "d620138fe0aa91f4"), Math::BigInt->new ("0x" . "acf86347d09f188d"), + Math::BigInt->new ("0x" . "2390f21f80c18306"), Math::BigInt->new ("0x" . "594882d7b0f40a7f"), + Math::BigInt->new ("0x" . "1618f6fc78eb277b"), Math::BigInt->new ("0x" . "6cc0863448deae02"), + Math::BigInt->new ("0x" . "e3a8176c18803589"), Math::BigInt->new ("0x" . "997067a428b5bcf0"), + Math::BigInt->new ("0x" . "fa11fe77117cdf02"), Math::BigInt->new ("0x" . "80c98ebf2149567b"), + Math::BigInt->new ("0x" . "0fa11fe77117cdf0"), Math::BigInt->new ("0x" . "75796f2f41224489"), + Math::BigInt->new ("0x" . "3a291b04893d698d"), Math::BigInt->new ("0x" . "40f16bccb908e0f4"), + Math::BigInt->new ("0x" . "cf99fa94e9567b7f"), Math::BigInt->new ("0x" . "b5418a5cd963f206"), + Math::BigInt->new ("0x" . "513912c379682177"), Math::BigInt->new ("0x" . "2be1620b495da80e"), + Math::BigInt->new ("0x" . "a489f35319033385"), Math::BigInt->new ("0x" . "de51839b2936bafc"), + Math::BigInt->new ("0x" . "9101f7b0e12997f8"), Math::BigInt->new ("0x" . "ebd98778d11c1e81"), + Math::BigInt->new ("0x" . "64b116208142850a"), Math::BigInt->new ("0x" . "1e6966e8b1770c73"), + Math::BigInt->new ("0x" . "8719014c99c2b083"), Math::BigInt->new ("0x" . "fdc17184a9f739fa"), + Math::BigInt->new ("0x" . "72a9e0dcf9a9a271"), Math::BigInt->new ("0x" . "08719014c99c2b08"), + Math::BigInt->new ("0x" . "4721e43f0183060c"), Math::BigInt->new ("0x" . "3df994f731b68f75"), + Math::BigInt->new ("0x" . "b29105af61e814fe"), Math::BigInt->new ("0x" . "c849756751dd9d87"), + Math::BigInt->new ("0x" . "2c31edf8f1d64ef6"), Math::BigInt->new ("0x" . "56e99d30c1e3c78f"), + Math::BigInt->new ("0x" . "d9810c6891bd5c04"), Math::BigInt->new ("0x" . "a3597ca0a188d57d"), + Math::BigInt->new ("0x" . "ec09088b6997f879"), Math::BigInt->new ("0x" . "96d1784359a27100"), + Math::BigInt->new ("0x" . "19b9e91b09fcea8b"), Math::BigInt->new ("0x" . "636199d339c963f2"), + Math::BigInt->new ("0x" . "df7adabd7a6e2d6f"), Math::BigInt->new ("0x" . "a5a2aa754a5ba416"), + Math::BigInt->new ("0x" . "2aca3b2d1a053f9d"), Math::BigInt->new ("0x" . "50124be52a30b6e4"), + Math::BigInt->new ("0x" . "1f423fcee22f9be0"), Math::BigInt->new ("0x" . "659a4f06d21a1299"), + Math::BigInt->new ("0x" . "eaf2de5e82448912"), Math::BigInt->new ("0x" . "902aae96b271006b"), + Math::BigInt->new ("0x" . "74523609127ad31a"), Math::BigInt->new ("0x" . "0e8a46c1224f5a63"), + Math::BigInt->new ("0x" . "81e2d7997211c1e8"), Math::BigInt->new ("0x" . "fb3aa75142244891"), + Math::BigInt->new ("0x" . "b46ad37a8a3b6595"), Math::BigInt->new ("0x" . "ceb2a3b2ba0eecec"), + Math::BigInt->new ("0x" . "41da32eaea507767"), Math::BigInt->new ("0x" . "3b024222da65fe1e"), + Math::BigInt->new ("0x" . "a2722586f2d042ee"), Math::BigInt->new ("0x" . "d8aa554ec2e5cb97"), + Math::BigInt->new ("0x" . "57c2c41692bb501c"), Math::BigInt->new ("0x" . "2d1ab4dea28ed965"), + Math::BigInt->new ("0x" . "624ac0f56a91f461"), Math::BigInt->new ("0x" . "1892b03d5aa47d18"), + Math::BigInt->new ("0x" . "97fa21650afae693"), Math::BigInt->new ("0x" . "ed2251ad3acf6fea"), + Math::BigInt->new ("0x" . "095ac9329ac4bc9b"), Math::BigInt->new ("0x" . "7382b9faaaf135e2"), + Math::BigInt->new ("0x" . "fcea28a2faafae69"), Math::BigInt->new ("0x" . "8632586aca9a2710"), + Math::BigInt->new ("0x" . "c9622c4102850a14"), Math::BigInt->new ("0x" . "b3ba5c8932b0836d"), + Math::BigInt->new ("0x" . "3cd2cdd162ee18e6"), Math::BigInt->new ("0x" . "460abd1952db919f"), + Math::BigInt->new ("0x" . "256b24ca6b12f26d"), Math::BigInt->new ("0x" . "5fb354025b277b14"), + Math::BigInt->new ("0x" . "d0dbc55a0b79e09f"), Math::BigInt->new ("0x" . "aa03b5923b4c69e6"), + Math::BigInt->new ("0x" . "e553c1b9f35344e2"), Math::BigInt->new ("0x" . "9f8bb171c366cd9b"), + Math::BigInt->new ("0x" . "10e3202993385610"), Math::BigInt->new ("0x" . "6a3b50e1a30ddf69"), + Math::BigInt->new ("0x" . "8e43c87e03060c18"), Math::BigInt->new ("0x" . "f49bb8b633338561"), + Math::BigInt->new ("0x" . "7bf329ee636d1eea"), Math::BigInt->new ("0x" . "012b592653589793"), + Math::BigInt->new ("0x" . "4e7b2d0d9b47ba97"), Math::BigInt->new ("0x" . "34a35dc5ab7233ee"), + Math::BigInt->new ("0x" . "bbcbcc9dfb2ca865"), Math::BigInt->new ("0x" . "c113bc55cb19211c"), + Math::BigInt->new ("0x" . "5863dbf1e3ac9dec"), Math::BigInt->new ("0x" . "22bbab39d3991495"), + Math::BigInt->new ("0x" . "add33a6183c78f1e"), Math::BigInt->new ("0x" . "d70b4aa9b3f20667"), + Math::BigInt->new ("0x" . "985b3e827bed2b63"), Math::BigInt->new ("0x" . "e2834e4a4bd8a21a"), + Math::BigInt->new ("0x" . "6debdf121b863991"), Math::BigInt->new ("0x" . "1733afda2bb3b0e8"), + Math::BigInt->new ("0x" . "f34b37458bb86399"), Math::BigInt->new ("0x" . "8993478dbb8deae0"), + Math::BigInt->new ("0x" . "06fbd6d5ebd3716b"), Math::BigInt->new ("0x" . "7c23a61ddbe6f812"), + Math::BigInt->new ("0x" . "3373d23613f9d516"), Math::BigInt->new ("0x" . "49aba2fe23cc5c6f"), + Math::BigInt->new ("0x" . "c6c333a67392c7e4"), Math::BigInt->new ("0x" . "bc1b436e43a74e9d"), + Math::BigInt->new ("0x" . "95ac9329ac4bc9b5"), Math::BigInt->new ("0x" . "ef74e3e19c7e40cc"), + Math::BigInt->new ("0x" . "601c72b9cc20db47"), Math::BigInt->new ("0x" . "1ac40271fc15523e"), + Math::BigInt->new ("0x" . "5594765a340a7f3a"), Math::BigInt->new ("0x" . "2f4c0692043ff643"), + Math::BigInt->new ("0x" . "a02497ca54616dc8"), Math::BigInt->new ("0x" . "dafce7026454e4b1"), + Math::BigInt->new ("0x" . "3e847f9dc45f37c0"), Math::BigInt->new ("0x" . "445c0f55f46abeb9"), + Math::BigInt->new ("0x" . "cb349e0da4342532"), Math::BigInt->new ("0x" . "b1eceec59401ac4b"), + Math::BigInt->new ("0x" . "febc9aee5c1e814f"), Math::BigInt->new ("0x" . "8464ea266c2b0836"), + Math::BigInt->new ("0x" . "0b0c7b7e3c7593bd"), Math::BigInt->new ("0x" . "71d40bb60c401ac4"), + Math::BigInt->new ("0x" . "e8a46c1224f5a634"), Math::BigInt->new ("0x" . "927c1cda14c02f4d"), + Math::BigInt->new ("0x" . "1d148d82449eb4c6"), Math::BigInt->new ("0x" . "67ccfd4a74ab3dbf"), + Math::BigInt->new ("0x" . "289c8961bcb410bb"), Math::BigInt->new ("0x" . "5244f9a98c8199c2"), + Math::BigInt->new ("0x" . "dd2c68f1dcdf0249"), Math::BigInt->new ("0x" . "a7f41839ecea8b30"), + Math::BigInt->new ("0x" . "438c80a64ce15841"), Math::BigInt->new ("0x" . "3954f06e7cd4d138"), + Math::BigInt->new ("0x" . "b63c61362c8a4ab3"), Math::BigInt->new ("0x" . "cce411fe1cbfc3ca"), + Math::BigInt->new ("0x" . "83b465d5d4a0eece"), Math::BigInt->new ("0x" . "f96c151de49567b7"), + Math::BigInt->new ("0x" . "76048445b4cbfc3c"), Math::BigInt->new ("0x" . "0cdcf48d84fe7545"), + Math::BigInt->new ("0x" . "6fbd6d5ebd3716b7"), Math::BigInt->new ("0x" . "15651d968d029fce"), + Math::BigInt->new ("0x" . "9a0d8ccedd5c0445"), Math::BigInt->new ("0x" . "e0d5fc06ed698d3c"), + Math::BigInt->new ("0x" . "af85882d2576a038"), Math::BigInt->new ("0x" . "d55df8e515432941"), + Math::BigInt->new ("0x" . "5a3569bd451db2ca"), Math::BigInt->new ("0x" . "20ed197575283bb3"), + Math::BigInt->new ("0x" . "c49581ead523e8c2"), Math::BigInt->new ("0x" . "be4df122e51661bb"), + Math::BigInt->new ("0x" . "3125607ab548fa30"), Math::BigInt->new ("0x" . "4bfd10b2857d7349"), + Math::BigInt->new ("0x" . "04ad64994d625e4d"), Math::BigInt->new ("0x" . "7e7514517d57d734"), + Math::BigInt->new ("0x" . "f11d85092d094cbf"), Math::BigInt->new ("0x" . "8bc5f5c11d3cc5c6"), + Math::BigInt->new ("0x" . "12b5926535897936"), Math::BigInt->new ("0x" . "686de2ad05bcf04f"), + Math::BigInt->new ("0x" . "e70573f555e26bc4"), Math::BigInt->new ("0x" . "9ddd033d65d7e2bd"), + Math::BigInt->new ("0x" . "d28d7716adc8cfb9"), Math::BigInt->new ("0x" . "a85507de9dfd46c0"), + Math::BigInt->new ("0x" . "273d9686cda3dd4b"), Math::BigInt->new ("0x" . "5de5e64efd965432"), + Math::BigInt->new ("0x" . "b99d7ed15d9d8743"), Math::BigInt->new ("0x" . "c3450e196da80e3a"), + Math::BigInt->new ("0x" . "4c2d9f413df695b1"), Math::BigInt->new ("0x" . "36f5ef890dc31cc8"), + Math::BigInt->new ("0x" . "79a59ba2c5dc31cc"), Math::BigInt->new ("0x" . "037deb6af5e9b8b5"), + Math::BigInt->new ("0x" . "8c157a32a5b7233e"), Math::BigInt->new ("0x" . "f6cd0afa9582aa47"), + Math::BigInt->new ("0x" . "4ad64994d625e4da"), Math::BigInt->new ("0x" . "300e395ce6106da3"), + Math::BigInt->new ("0x" . "bf66a804b64ef628"), Math::BigInt->new ("0x" . "c5bed8cc867b7f51"), + Math::BigInt->new ("0x" . "8aeeace74e645255"), Math::BigInt->new ("0x" . "f036dc2f7e51db2c"), + Math::BigInt->new ("0x" . "7f5e4d772e0f40a7"), Math::BigInt->new ("0x" . "05863dbf1e3ac9de"), + Math::BigInt->new ("0x" . "e1fea520be311aaf"), Math::BigInt->new ("0x" . "9b26d5e88e0493d6"), + Math::BigInt->new ("0x" . "144e44b0de5a085d"), Math::BigInt->new ("0x" . "6e963478ee6f8124"), + Math::BigInt->new ("0x" . "21c640532670ac20"), Math::BigInt->new ("0x" . "5b1e309b16452559"), + Math::BigInt->new ("0x" . "d476a1c3461bbed2"), Math::BigInt->new ("0x" . "aeaed10b762e37ab"), + Math::BigInt->new ("0x" . "37deb6af5e9b8b5b"), Math::BigInt->new ("0x" . "4d06c6676eae0222"), + Math::BigInt->new ("0x" . "c26e573f3ef099a9"), Math::BigInt->new ("0x" . "b8b627f70ec510d0"), + Math::BigInt->new ("0x" . "f7e653dcc6da3dd4"), Math::BigInt->new ("0x" . "8d3e2314f6efb4ad"), + Math::BigInt->new ("0x" . "0256b24ca6b12f26"), Math::BigInt->new ("0x" . "788ec2849684a65f"), + Math::BigInt->new ("0x" . "9cf65a1b368f752e"), Math::BigInt->new ("0x" . "e62e2ad306bafc57"), + Math::BigInt->new ("0x" . "6946bb8b56e467dc"), Math::BigInt->new ("0x" . "139ecb4366d1eea5"), + Math::BigInt->new ("0x" . "5ccebf68aecec3a1"), Math::BigInt->new ("0x" . "2616cfa09efb4ad8"), + Math::BigInt->new ("0x" . "a97e5ef8cea5d153"), Math::BigInt->new ("0x" . "d3a62e30fe90582a"), + Math::BigInt->new ("0x" . "b0c7b7e3c7593bd8"), Math::BigInt->new ("0x" . "ca1fc72bf76cb2a1"), + Math::BigInt->new ("0x" . "45775673a732292a"), Math::BigInt->new ("0x" . "3faf26bb9707a053"), + Math::BigInt->new ("0x" . "70ff52905f188d57"), Math::BigInt->new ("0x" . "0a2722586f2d042e"), + Math::BigInt->new ("0x" . "854fb3003f739fa5"), Math::BigInt->new ("0x" . "ff97c3c80f4616dc"), + Math::BigInt->new ("0x" . "1bef5b57af4dc5ad"), Math::BigInt->new ("0x" . "61372b9f9f784cd4"), + Math::BigInt->new ("0x" . "ee5fbac7cf26d75f"), Math::BigInt->new ("0x" . "9487ca0fff135e26"), + Math::BigInt->new ("0x" . "dbd7be24370c7322"), Math::BigInt->new ("0x" . "a10fceec0739fa5b"), + Math::BigInt->new ("0x" . "2e675fb4576761d0"), Math::BigInt->new ("0x" . "54bf2f7c6752e8a9"), + Math::BigInt->new ("0x" . "cdcf48d84fe75459"), Math::BigInt->new ("0x" . "b71738107fd2dd20"), + Math::BigInt->new ("0x" . "387fa9482f8c46ab"), Math::BigInt->new ("0x" . "42a7d9801fb9cfd2"), + Math::BigInt->new ("0x" . "0df7adabd7a6e2d6"), Math::BigInt->new ("0x" . "772fdd63e7936baf"), + Math::BigInt->new ("0x" . "f8474c3bb7cdf024"), Math::BigInt->new ("0x" . "829f3cf387f8795d"), + Math::BigInt->new ("0x" . "66e7a46c27f3aa2c"), Math::BigInt->new ("0x" . "1c3fd4a417c62355"), + Math::BigInt->new ("0x" . "935745fc4798b8de"), Math::BigInt->new ("0x" . "e98f353477ad31a7"), + Math::BigInt->new ("0x" . "a6df411fbfb21ca3"), Math::BigInt->new ("0x" . "dc0731d78f8795da"), + Math::BigInt->new ("0x" . "536fa08fdfd90e51"), Math::BigInt->new ("0x" . "29b7d047efec8728"), +); + +sub crc64 +{ + my $h = shift; + + my $data = shift; + + my @datas = split "", $data; + + for (my $i = 0; $i < scalar @datas; $i++) + { + $h = $tbl[(($h >> 0) & 0xff) ^ ord ($datas[$i])] ^ ($h >> 8); + } + + return $h; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $iv = Math::BigInt->new ("0x" . $salt); + + my $checksum = crc64 ($iv, $word); + + my $hash = sprintf ("%016x:%016x", $checksum, $iv); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1;