1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-05 06:12:35 +00:00
hashcat/OpenCL/inc_hash_scrypt.h
Jens Steube 825491aa6c Rewrote the SCRYPT core to work around a segmentation fault bug in the Intel OpenCL CPU runtime, without negatively affecting other runtimes.
Fixed the automatic kernel acceleration adjustment routine to account for some OpenCL runtime's buffer size limitation (1/4).
Added a missing license header to scrypt_commit.c (MIT).
2025-06-26 09:47:36 +02:00

58 lines
1.2 KiB
C

/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef INC_HASH_SCRYPT_H
#define INC_HASH_SCRYPT_H
#define GET_SCRYPT_SZ(r,p) (128 * (r) * (p))
#define GET_STATE_SZ(r) (128 * (r))
// _SZ is true sizes as bytes
#define SCRYPT_SZ GET_SCRYPT_SZ (SCRYPT_R, SCRYPT_P)
#define STATE_SZ GET_STATE_SZ (SCRYPT_R)
// _CNT is size as whatever /X datatype
#define SCRYPT_CNT4 (SCRYPT_SZ / 4)
#define STATE_CNT4 (STATE_SZ / 4)
// this would be uint4, feels more natural than 16
#define SCRYPT_CNT44 ((SCRYPT_SZ / 4) / 4)
#define STATE_CNT44 ((STATE_SZ / 4) / 4)
#define SALSA_SZ 64
#define SALSA_CNT4 (SALSA_SZ / 4)
#define SALSA_CNT44 ((SALSA_SZ / 4) / 4)
//#define VIDX(bid4,lsz,lid,ySIZE,zSIZE,y,z) (((bid4) * (lsz) * (ySIZE) * (zSIZE)) + ((lid) * (ySIZE) * (zSIZE)) + ((y) * (zSIZE)) + (z))
#if defined IS_CUDA
DECLSPEC uint4 operator ^ (const uint4 a, const uint4 b)
{
uint4 r;
r.x = a.x ^ b.x;
r.y = a.y ^ b.y;
r.z = a.z ^ b.z;
r.w = a.w ^ b.w;
return r;
}
#endif
typedef struct
{
#ifndef SCRYPT_TMP_ELEM
#define SCRYPT_TMP_ELEM 1
#endif
u32 in[SCRYPT_TMP_ELEM / 2];
u32 out[SCRYPT_TMP_ELEM / 2];
} scrypt_tmp_t;
#endif