1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-27 02:18:21 +00:00
hashcat/OpenCL/inc_simd.cl

66 lines
3.4 KiB
Common Lisp
Raw Normal View History

/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "inc_vendor.h"
#include "inc_types.h"
2019-04-26 11:59:43 +00:00
#include "inc_platform.h"
#include "inc_common.h"
#include "inc_simd.h"
// attack-mode 0
2019-05-11 07:32:16 +00:00
DECLSPEC u32x ix_create_bft (CONSTANT_AS const bf_t *arr, const u32 il_pos)
{
#if VECT_SIZE == 1
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i);
#elif VECT_SIZE == 2
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i, arr[il_pos + 1].i);
#elif VECT_SIZE == 4
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i, arr[il_pos + 1].i, arr[il_pos + 2].i, arr[il_pos + 3].i);
#elif VECT_SIZE == 8
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i, arr[il_pos + 1].i, arr[il_pos + 2].i, arr[il_pos + 3].i, arr[il_pos + 4].i, arr[il_pos + 5].i, arr[il_pos + 6].i, arr[il_pos + 7].i);
#elif VECT_SIZE == 16
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i, arr[il_pos + 1].i, arr[il_pos + 2].i, arr[il_pos + 3].i, arr[il_pos + 4].i, arr[il_pos + 5].i, arr[il_pos + 6].i, arr[il_pos + 7].i, arr[il_pos + 8].i, arr[il_pos + 9].i, arr[il_pos + 10].i, arr[il_pos + 11].i, arr[il_pos + 12].i, arr[il_pos + 13].i, arr[il_pos + 14].i, arr[il_pos + 15].i);
#endif
2016-02-20 15:13:06 +00:00
return ix;
}
// attack-mode 1
2019-05-11 07:32:16 +00:00
DECLSPEC u32x pwlenx_create_combt (GLOBAL_AS const pw_t *arr, const u32 il_pos)
2016-02-20 15:13:06 +00:00
{
#if VECT_SIZE == 1
2019-05-11 07:32:16 +00:00
const u32x pw_lenx = make_u32x (arr[il_pos + 0].pw_len);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 2
2019-05-11 07:32:16 +00:00
const u32x pw_lenx = make_u32x (arr[il_pos + 0].pw_len, arr[il_pos + 1].pw_len);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 4
2019-05-11 07:32:16 +00:00
const u32x pw_lenx = make_u32x (arr[il_pos + 0].pw_len, arr[il_pos + 1].pw_len, arr[il_pos + 2].pw_len, arr[il_pos + 3].pw_len);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 8
2019-05-11 07:32:16 +00:00
const u32x pw_lenx = make_u32x (arr[il_pos + 0].pw_len, arr[il_pos + 1].pw_len, arr[il_pos + 2].pw_len, arr[il_pos + 3].pw_len, arr[il_pos + 4].pw_len, arr[il_pos + 5].pw_len, arr[il_pos + 6].pw_len, arr[il_pos + 7].pw_len);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 16
2019-05-11 07:32:16 +00:00
const u32x pw_lenx = make_u32x (arr[il_pos + 0].pw_len, arr[il_pos + 1].pw_len, arr[il_pos + 2].pw_len, arr[il_pos + 3].pw_len, arr[il_pos + 4].pw_len, arr[il_pos + 5].pw_len, arr[il_pos + 6].pw_len, arr[il_pos + 7].pw_len, arr[il_pos + 8].pw_len, arr[il_pos + 9].pw_len, arr[il_pos + 10].pw_len, arr[il_pos + 11].pw_len, arr[il_pos + 12].pw_len, arr[il_pos + 13].pw_len, arr[il_pos + 14].pw_len, arr[il_pos + 15].pw_len);
2016-02-20 15:13:06 +00:00
#endif
return pw_lenx;
}
2019-05-11 07:32:16 +00:00
DECLSPEC u32x ix_create_combt (GLOBAL_AS const pw_t *arr, const u32 il_pos, const int idx)
2016-02-20 15:13:06 +00:00
{
#if VECT_SIZE == 1
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i[idx]);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 2
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i[idx], arr[il_pos + 1].i[idx]);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 4
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i[idx], arr[il_pos + 1].i[idx], arr[il_pos + 2].i[idx], arr[il_pos + 3].i[idx]);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 8
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i[idx], arr[il_pos + 1].i[idx], arr[il_pos + 2].i[idx], arr[il_pos + 3].i[idx], arr[il_pos + 4].i[idx], arr[il_pos + 5].i[idx], arr[il_pos + 6].i[idx], arr[il_pos + 7].i[idx]);
2016-02-20 15:13:06 +00:00
#elif VECT_SIZE == 16
2019-05-11 07:32:16 +00:00
const u32x ix = make_u32x (arr[il_pos + 0].i[idx], arr[il_pos + 1].i[idx], arr[il_pos + 2].i[idx], arr[il_pos + 3].i[idx], arr[il_pos + 4].i[idx], arr[il_pos + 5].i[idx], arr[il_pos + 6].i[idx], arr[il_pos + 7].i[idx], arr[il_pos + 8].i[idx], arr[il_pos + 9].i[idx], arr[il_pos + 10].i[idx], arr[il_pos + 11].i[idx], arr[il_pos + 12].i[idx], arr[il_pos + 13].i[idx], arr[il_pos + 14].i[idx], arr[il_pos + 15].i[idx]);
2016-02-20 15:13:06 +00:00
#endif
return ix;
}