mirror of
https://github.com/hashcat/hashcat.git
synced 2025-02-22 04:22:13 +00:00
Merge pull request #2053 from philsmd/master
PKZIP: improve decompression and allow up to 320KB data length
This commit is contained in:
commit
0370f73a44
@ -180,7 +180,7 @@ typedef int mz_bool;
|
||||
|
||||
typedef mz_uint64 tinfl_bit_buf_t;
|
||||
|
||||
void memcpy(void *dest, const void *src, u32 n){
|
||||
DECLSPEC void memcpy(void *dest, const void *src, u32 n){
|
||||
char *csrc = (char *)src;
|
||||
char *cdest = (char *)dest;
|
||||
for (int i=0; i<n; i++){
|
||||
@ -189,7 +189,7 @@ void memcpy(void *dest, const void *src, u32 n){
|
||||
}
|
||||
|
||||
|
||||
void *memset(u8 *s, int c, u32 len){
|
||||
DECLSPEC void *memset(u8 *s, int c, u32 len){
|
||||
u8 *dst = s;
|
||||
while (len > 0) {
|
||||
*dst = (u8) c;
|
||||
@ -263,13 +263,13 @@ enum
|
||||
} \
|
||||
MZ_MACRO_END
|
||||
|
||||
//case state_index:;
|
||||
#define TINFL_CR_RETURN(state_index, result) \
|
||||
do \
|
||||
{ \
|
||||
status = result; \
|
||||
r->m_state = state_index; \
|
||||
goto common_exit; \
|
||||
case state_index:; \
|
||||
} \
|
||||
MZ_MACRO_END
|
||||
|
||||
@ -411,7 +411,7 @@ typedef struct
|
||||
tinfl_decompressor m_decomp;
|
||||
mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed;
|
||||
int m_window_bits;
|
||||
mz_uint8 m_dict[TINFL_LZ_DICT_SIZE];
|
||||
mz_uint8 m_dict[1]; // hashcat-patched: we do not need m_dict because we have our own output buffer
|
||||
tinfl_status m_last_status;
|
||||
|
||||
} inflate_state;
|
||||
@ -447,18 +447,18 @@ typedef struct mz_stream_s
|
||||
|
||||
typedef mz_stream *mz_streamp;
|
||||
|
||||
|
||||
void miniz_def_free_func(void *opaque, void *address);
|
||||
void *miniz_def_alloc_func(void *opaque, size_t items, size_t size);
|
||||
int mz_inflate(mz_streamp pStream, int flush);
|
||||
int mz_inflateEnd(mz_streamp pStream);
|
||||
// hashcat-patched: not needed functions:
|
||||
// void miniz_def_free_func(void *opaque, void *address);
|
||||
// void *miniz_def_alloc_func(void *opaque, size_t items, size_t size);
|
||||
DECLSPEC int mz_inflate(mz_streamp pStream, int flush);
|
||||
DECLSPEC int mz_inflateEnd(mz_streamp pStream);
|
||||
|
||||
|
||||
|
||||
int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state*);
|
||||
DECLSPEC int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state*);
|
||||
|
||||
|
||||
const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream)
|
||||
DECLSPEC const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream)
|
||||
{
|
||||
mz_uint8 r = c;
|
||||
|
||||
@ -472,7 +472,7 @@ const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream)
|
||||
}
|
||||
|
||||
|
||||
void memcpy_g(void *dest, GLOBAL_AS const void *src, size_t n, mz_streamp pStream){
|
||||
DECLSPEC void memcpy_g(void *dest, GLOBAL_AS const void *src, size_t n, mz_streamp pStream){
|
||||
GLOBAL_AS char *csrc = (GLOBAL_AS char *)src;
|
||||
char *cdest = (char *)dest;
|
||||
for (int i=0; i<n; i++){
|
||||
@ -480,7 +480,7 @@ void memcpy_g(void *dest, GLOBAL_AS const void *src, size_t n, mz_streamp pStrea
|
||||
}
|
||||
}
|
||||
|
||||
tinfl_status tinfl_decompress(tinfl_decompressor *r, GLOBAL_AS const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags, mz_streamp pStream)
|
||||
DECLSPEC tinfl_status tinfl_decompress(tinfl_decompressor *r, GLOBAL_AS const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags, mz_streamp pStream)
|
||||
{
|
||||
|
||||
const int s_length_base[31] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 };
|
||||
@ -944,7 +944,7 @@ common_exit:
|
||||
}
|
||||
|
||||
|
||||
int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state *pDecomp)
|
||||
DECLSPEC int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state *pDecomp)
|
||||
{
|
||||
if (pStream == 0)
|
||||
return MZ_STREAM_ERROR;
|
||||
@ -972,7 +972,7 @@ int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state *pDecomp)
|
||||
return MZ_OK;
|
||||
}
|
||||
|
||||
int mz_inflate(mz_streamp pStream, int flush)
|
||||
DECLSPEC int mz_inflate(mz_streamp pStream, int flush)
|
||||
{
|
||||
inflate_state *pState;
|
||||
mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32;
|
||||
@ -1102,3 +1102,101 @@ int mz_inflate(mz_streamp pStream, int flush)
|
||||
|
||||
return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
|
||||
}
|
||||
|
||||
// hashcat-patched: helper function for shifted u32
|
||||
|
||||
DECLSPEC u32 GETSHIFTEDINT (u32 *a, const int n)
|
||||
{
|
||||
const int d = n / 4;
|
||||
const int m = n & 3;
|
||||
|
||||
u64 tmp = hl32_to_64_S (a[d + 1], a[d + 0]);
|
||||
|
||||
tmp >>= m * 8;
|
||||
|
||||
return l32_from_64_S (tmp);
|
||||
}
|
||||
|
||||
// hashcat-patched: faster memcpy for our large (TINFL_LZ_DICT_SIZE) move of bytes from the old output to the window/lookup table
|
||||
|
||||
DECLSPEC void hc_shift_inflate_dict (u8 *buf, const u32 offset, const u32 len)
|
||||
{
|
||||
u32 *ptr = (u32 *) buf;
|
||||
|
||||
// we need to use len - 4 here to avoid buffer overflows caused by the u64 type in GETSHIFTEDINT
|
||||
|
||||
u32 i, j;
|
||||
|
||||
for (i = 0, j = 0; i < len - 4; i += 4, j++)
|
||||
{
|
||||
ptr[j] = GETSHIFTEDINT (ptr, offset + i);
|
||||
}
|
||||
|
||||
// final step (last 4 bytes are special):
|
||||
|
||||
ptr[j] = (buf[offset + i + 3] << 24) | (buf[offset + i + 2] << 16) | (buf[offset + i + 1] << 8) | buf[offset + i];
|
||||
}
|
||||
|
||||
// hashcat-patched: the mz_inflate () function from above doesn't work for us because we need to allow larger input/output and
|
||||
// we only need the crc32 checksum actually
|
||||
|
||||
DECLSPEC int hc_inflate (mz_streamp pStream)
|
||||
{
|
||||
// we can't use the full TINFL_LZ_DICT_SIZE buffer because even with only 16 input bytes
|
||||
// we can get pretty close to our max available output buffer:
|
||||
|
||||
// size_t in_bytes = MZ_MIN (TINFL_LZ_DICT_SIZE, pStream->avail_in);
|
||||
size_t in_bytes = MZ_MIN (16, pStream->avail_in);
|
||||
|
||||
mz_uint decomp_flags = ((pStream->avail_in - in_bytes) > 0) ? TINFL_FLAG_HAS_MORE_INPUT : 0;
|
||||
|
||||
decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF;
|
||||
|
||||
inflate_state *pState = pStream->state;
|
||||
|
||||
size_t out_bytes = pStream->avail_out;
|
||||
|
||||
tinfl_status status = tinfl_decompress (&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out + pStream->total_out, &out_bytes, decomp_flags, pStream);
|
||||
|
||||
for (int i = 0; i < out_bytes; i++)
|
||||
{
|
||||
pStream->crc32 = CRC32 (pStream->crc32, pStream->next_out[pStream->total_out + i], pStream->crc32tab);
|
||||
}
|
||||
|
||||
pStream->next_in += (mz_uint) in_bytes;
|
||||
pStream->avail_in -= (mz_uint) in_bytes;
|
||||
pStream->total_in += (mz_uint) in_bytes;
|
||||
|
||||
pStream->avail_out -= out_bytes;
|
||||
pStream->total_out += out_bytes;
|
||||
|
||||
if (pStream->avail_out < TINFL_LZ_DICT_SIZE)
|
||||
{
|
||||
// reset:
|
||||
|
||||
// move the last TINFL_LZ_DICT_SIZE bytes to the start of the output buffer
|
||||
|
||||
// memcpy (pStream->next_out, pStream->next_out + pStream->total_out - TINFL_LZ_DICT_SIZE, TINFL_LZ_DICT_SIZE);
|
||||
hc_shift_inflate_dict (pStream->next_out, pStream->total_out - TINFL_LZ_DICT_SIZE, TINFL_LZ_DICT_SIZE);
|
||||
|
||||
pStream->avail_out = TINFL_LZ_DICT_SIZE;
|
||||
pStream->total_out = TINFL_LZ_DICT_SIZE;
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
return MZ_DATA_ERROR;
|
||||
}
|
||||
|
||||
if (in_bytes == 0)
|
||||
{
|
||||
return MZ_STREAM_END;
|
||||
}
|
||||
|
||||
if (pStream->avail_in == 0)
|
||||
{
|
||||
return MZ_STREAM_END;
|
||||
}
|
||||
|
||||
return (status == TINFL_STATUS_DONE) ? MZ_STREAM_END : MZ_OK;
|
||||
}
|
||||
|
@ -94,13 +94,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_rp.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -132,7 +132,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -325,22 +325,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -410,7 +410,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -550,7 +550,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -559,7 +559,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -749,11 +749,11 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) continue; // failed to inflate
|
||||
@ -788,7 +788,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -797,7 +797,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -975,11 +975,11 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) continue; // failed to inflate
|
||||
|
@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_simd.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -323,22 +323,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -408,7 +408,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -548,7 +548,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -557,7 +557,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -751,11 +751,11 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) continue; // failed to inflate
|
||||
@ -790,7 +790,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -799,7 +799,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -981,11 +981,11 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) continue; // failed to inflate
|
||||
|
@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_simd.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -325,22 +325,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -409,7 +409,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -549,7 +549,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -558,7 +558,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -764,11 +764,11 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) continue; // failed to inflate
|
||||
@ -803,7 +803,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -812,7 +812,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1006,11 +1006,11 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) continue; // failed to inflate
|
||||
|
@ -100,7 +100,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -132,7 +132,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -241,7 +241,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -250,7 +250,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -480,7 +480,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -489,7 +489,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -239,7 +239,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -248,7 +248,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -480,7 +480,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -489,7 +489,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -239,7 +239,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -248,7 +248,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -492,7 +492,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -501,7 +501,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hash.data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -94,13 +94,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_rp.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -132,7 +132,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -323,22 +323,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -408,7 +408,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -548,7 +548,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -557,7 +557,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -750,11 +750,11 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -813,7 +813,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -822,7 +822,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1015,11 +1015,11 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
|
@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_simd.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -546,7 +546,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -555,7 +555,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -750,11 +750,11 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -813,7 +813,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -822,7 +822,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1017,11 +1017,11 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
|
@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_simd.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -546,7 +546,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -555,7 +555,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -762,11 +762,11 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -825,7 +825,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -834,7 +834,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1041,11 +1041,11 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -1078,4 +1078,4 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
#undef CONST
|
||||
#undef MAX_DATA
|
||||
#undef update_key012
|
||||
#undef update_key3
|
||||
#undef update_key3
|
||||
|
@ -94,13 +94,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_rp.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -132,7 +132,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -323,22 +323,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -408,7 +408,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -548,7 +548,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -557,7 +557,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -759,11 +759,11 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -876,7 +876,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -885,7 +885,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1087,11 +1087,11 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
|
@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_simd.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -546,7 +546,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -555,7 +555,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -759,11 +759,11 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -875,7 +875,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -884,7 +884,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1088,11 +1088,11 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
|
@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#include "inc_simd.cl"
|
||||
|
||||
#define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible
|
||||
#define TMPSIZ 32
|
||||
#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE)
|
||||
|
||||
#define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff])
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next)
|
||||
u32 ncode;
|
||||
u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions.
|
||||
u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment.
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32)next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
count = (u8*)ncount;
|
||||
|
||||
if (257+(hold&0x1F) > 286)
|
||||
if (257 + (hold & 0x1F) > 286)
|
||||
{
|
||||
return 0; // nlen, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
if (1+(hold&0x1F) > 30)
|
||||
if (1 + (hold & 0x1F) > 30)
|
||||
{
|
||||
return 0; // ndist, but we do not use it.
|
||||
}
|
||||
hold >>= 5;
|
||||
ncode = 4+(hold&0xF);
|
||||
ncode = 4 + (hold & 0xF);
|
||||
hold >>= 4;
|
||||
|
||||
// we have 15 bits left.
|
||||
@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left)
|
||||
u32 whave = 0, op, bits, hold,len;
|
||||
code here1;
|
||||
|
||||
hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24);
|
||||
hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24);
|
||||
next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back.
|
||||
left -= 4;
|
||||
hold >>= 3; // we already processed 3 bits
|
||||
@ -546,7 +546,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -555,7 +555,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -771,11 +771,11 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -887,7 +887,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -896,7 +896,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -1112,11 +1112,11 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
// inflateinit2 is needed because otherwise it checks for headers by default
|
||||
mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream);
|
||||
|
||||
int ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
int ret = hc_inflate (&infstream);
|
||||
|
||||
while (ret == MZ_OK)
|
||||
{
|
||||
ret = mz_inflate (&infstream, Z_SYNC_FLUSH);
|
||||
ret = hc_inflate (&infstream);
|
||||
}
|
||||
|
||||
if (ret != MZ_STREAM_END) break; // failed to inflate
|
||||
@ -1202,4 +1202,4 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
#undef CONST
|
||||
#undef MAX_DATA
|
||||
#undef update_key012
|
||||
#undef update_key3
|
||||
#undef update_key3
|
||||
|
@ -100,7 +100,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -132,7 +132,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -241,7 +241,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -250,7 +250,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -411,7 +411,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -420,7 +420,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_RULES_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -239,7 +239,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -248,7 +248,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -411,7 +411,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -420,7 +420,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp
|
||||
#define MSB(x) ((x) >> 24)
|
||||
#define CONST 0x08088405
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
#define update_key012(k0,k1,k2,c,t) \
|
||||
{ \
|
||||
@ -130,7 +130,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -239,7 +239,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -248,7 +248,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -425,7 +425,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
LOCAL_VK u32 l_data[MAX_LOCAL];
|
||||
|
||||
@ -434,7 +434,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t))
|
||||
l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -172,7 +172,7 @@ KERNEL_FQ void m20500_sxx (KERN_ATTR_RULES ())
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -246,7 +246,7 @@ KERNEL_FQ void m20500_mxx (KERN_ATTR_RULES ())
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -170,7 +170,7 @@ KERNEL_FQ void m20500_sxx (KERN_ATTR_BASIC ())
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -246,7 +246,7 @@ KERNEL_FQ void m20500_mxx (KERN_ATTR_BASIC ())
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -266,7 +266,7 @@ KERNEL_FQ void m20500_sxx (KERN_ATTR_VECTOR ())
|
||||
l_icrc32tab[i] = icrc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -380,7 +380,7 @@ KERNEL_FQ void m20500_mxx (KERN_ATTR_VECTOR ())
|
||||
l_crc32tab[i] = crc32tab[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -509,7 +509,7 @@ KERNEL_FQ void m20510_sxx (KERN_ATTR_RULES ())
|
||||
l_lsbk0_count1[i] = lsbk0_count1[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -507,7 +507,7 @@ KERNEL_FQ void m20510_sxx (KERN_ATTR_BASIC ())
|
||||
l_lsbk0_count1[i] = lsbk0_count1[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -507,7 +507,7 @@ KERNEL_FQ void m20510_sxx (KERN_ATTR_VECTOR ())
|
||||
l_lsbk0_count1[i] = lsbk0_count1[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS();
|
||||
SYNC_THREADS ();
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
|
@ -107,8 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$1*1*2*0*e3*1c5*eda7a8de*0*28*8*e3*eda7*5096*a9fc1f4e951c8fb3031a6f903e5f4e3211c8fdc4671547bf77f6f682afbfcc7475d83898985621a7af9bccd1349d1976500a68c48f630b7f22d7a0955524d768e34868880461335417ddd149c65a917c0eb0a4bf7224e24a1e04cf4ace5eef52205f4452e66ded937db9545f843a68b1e84a2e933cc05fb36d3db90e6c5faf1bee2249fdd06a7307849902a8bb24ec7e8a0886a4544ca47979a9dfeefe034bdfc5bd593904cfe9a5309dd199d337d3183f307c2cb39622549a5b9b8b485b7949a4803f63f67ca427a0640ad3793a519b2476c52198488e3e2e04cac202d624fb7d13c2*$/pkzip2$";
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_LEN (32 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
// this is required to force mingw to accept the packed attribute
|
||||
#pragma pack(push,1)
|
||||
@ -126,7 +125,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -187,95 +186,93 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
char input[line_len + 1];
|
||||
input[line_len] = '\0';
|
||||
memcpy(&input, line_buf, line_len);
|
||||
memcpy (&input, line_buf, line_len);
|
||||
|
||||
char *p = strtok(input, "*");
|
||||
char *p = strtok (input, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
|
||||
pkzip->version = 1;
|
||||
if(strlen(p) == 9) pkzip->version = 2;
|
||||
|
||||
if (strlen (p) == 9) pkzip->version = 2;
|
||||
|
||||
char sub[2];
|
||||
sub[0] = p[strlen(p) - 1];
|
||||
|
||||
sub[0] = p[strlen (p) - 1];
|
||||
sub[1] = '\0';
|
||||
pkzip->hash_count = atoi(sub);
|
||||
pkzip->hash_count = atoi (sub);
|
||||
|
||||
// check here that the hash_count is valid for the attack type
|
||||
if(pkzip->hash_count != 1) return PARSER_HASH_VALUE;
|
||||
if (pkzip->hash_count != 1) return PARSER_HASH_VALUE;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->checksum_size = atoi(p);
|
||||
pkzip->checksum_size = atoi (p);
|
||||
if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.data_type_enum = atoi(p);
|
||||
pkzip->hash.data_type_enum = atoi (p);
|
||||
if (pkzip->hash.data_type_enum > 3) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.magic_type_enum = atoi(p);
|
||||
pkzip->hash.magic_type_enum = atoi (p);
|
||||
|
||||
if(pkzip->hash.data_type_enum > 1)
|
||||
if (pkzip->hash.data_type_enum > 1)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.compressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hash.compressed_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.uncompressed_length = strtoul(p, NULL, 16);
|
||||
if (pkzip->hash.compressed_length > MAX_DATA * 4)
|
||||
pkzip->hash.uncompressed_length = strtoul (p, NULL, 16);
|
||||
if (pkzip->hash.compressed_length > MAX_DATA)
|
||||
{
|
||||
return PARSER_TOKEN_LENGTH;
|
||||
}
|
||||
if (pkzip->hash.uncompressed_length > MAX_LEN)
|
||||
{
|
||||
return PARSER_HASH_LENGTH;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%x", &(pkzip->hash.crc32));
|
||||
sscanf (p, "%x", &(pkzip->hash.crc32));
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.offset = strtoul(p, NULL, 16);
|
||||
pkzip->hash.offset = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.additional_offset = strtoul(p, NULL, 16);
|
||||
pkzip->hash.additional_offset = strtoul (p, NULL, 16);
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.compression_type = atoi(p);
|
||||
pkzip->hash.compression_type = atoi (p);
|
||||
if (pkzip->hash.compression_type != 8) return PARSER_PKZIP_CT_UNMATCHED;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.data_length = strtoul(p, NULL, 16);
|
||||
pkzip->hash.data_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hash.checksum_from_crc));
|
||||
if(pkzip->version == 2)
|
||||
sscanf (p, "%hx", &(pkzip->hash.checksum_from_crc));
|
||||
if (pkzip->version == 2)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hash.checksum_from_timestamp));
|
||||
sscanf (p, "%hx", &(pkzip->hash.checksum_from_timestamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
pkzip->hash.checksum_from_timestamp = pkzip->hash.checksum_from_crc;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
|
||||
hex_to_binary(p, strlen(p), (char *) &(pkzip->hash.data));
|
||||
hex_to_binary (p, strlen (p), (char *) &(pkzip->hash.data));
|
||||
|
||||
// fake salt
|
||||
u32 *ptr = (u32 *) pkzip->hash.data;
|
||||
|
@ -107,7 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$1*1*2*0*1d1*1c5*eda7a8de*0*28*0*1d1*eda7*5096*1dea673da43d9fc7e2be1a1f4f664269fceb6cb88723a97408ae1fe07f774d31d1442ea8485081e63f919851ca0b7588d5e3442317fff19fe547a4ef97492ed75417c427eea3c4e146e16c100a2f8b6abd7e5988dc967e5a0e51f641401605d673630ea52ebb04da4b388489901656532c9aa474ca090dbac7cf8a21428d57b42a71da5f3d83fed927361e5d385ca8e480a6d42dea5b4bf497d3a24e79fc7be37c8d1721238cbe9e1ea3ae1eb91fc02aabdf33070d718d5105b70b3d7f3d2c28b3edd822e89a5abc0c8fee117c7fbfbfd4b4c8e130977b75cb0b1da080bfe1c0859e6483c42f459c8069d45a76220e046e6c2a2417392fd87e4aa4a2559eaab3baf78a77a1b94d8c8af16a977b4bb45e3da211838ad044f209428dba82666bf3d54d4eed82c64a9b3444a44746b9e398d0516a2596d84243b4a1d7e87d9843f38e45b6be67fd980107f3ad7b8453d87300e6c51ac9f5e3f6c3b702654440c543b1d808b62f7a313a83b31a6faaeedc2620de7057cd0df80f70346fe2d4dccc318f0b5ed128bcf0643e63d754bb05f53afb2b0fa90b34b538b2ad3648209dff587df4fa18698e4fa6d858ad44aa55d2bba3b08dfdedd3e28b8b7caf394d5d9d95e452c2ab1c836b9d74538c2f0d24b9b577*$/pkzip2$";
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
// this is required to force mingw to accept the packed attribute
|
||||
#pragma pack(push,1)
|
||||
@ -125,7 +125,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -186,91 +186,92 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
char input[line_len + 1];
|
||||
input[line_len] = '\0';
|
||||
memcpy(&input, line_buf, line_len);
|
||||
memcpy (&input, line_buf, line_len);
|
||||
|
||||
char *p = strtok(input, "*");
|
||||
char *p = strtok (input, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
|
||||
pkzip->version = 1;
|
||||
if(strlen(p) == 9) pkzip->version = 2;
|
||||
|
||||
if (strlen (p) == 9) pkzip->version = 2;
|
||||
|
||||
char sub[2];
|
||||
sub[0] = p[strlen(p) - 1];
|
||||
sub[0] = p[strlen (p) - 1];
|
||||
sub[1] = '\0';
|
||||
pkzip->hash_count = atoi(sub);
|
||||
pkzip->hash_count = atoi (sub);
|
||||
|
||||
// check here that the hash_count is valid for the attack type
|
||||
if(pkzip->hash_count != 1) return PARSER_HASH_VALUE;
|
||||
if (pkzip->hash_count != 1) return PARSER_HASH_VALUE;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->checksum_size = atoi(p);
|
||||
pkzip->checksum_size = atoi (p);
|
||||
if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.data_type_enum = atoi(p);
|
||||
pkzip->hash.data_type_enum = atoi (p);
|
||||
if (pkzip->hash.data_type_enum > 3) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.magic_type_enum = atoi(p);
|
||||
pkzip->hash.magic_type_enum = atoi (p);
|
||||
|
||||
if(pkzip->hash.data_type_enum > 1)
|
||||
if (pkzip->hash.data_type_enum > 1)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.compressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hash.compressed_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.uncompressed_length = strtoul(p, NULL, 16);
|
||||
if (pkzip->hash.uncompressed_length > MAX_DATA * 4)
|
||||
pkzip->hash.uncompressed_length = strtoul (p, NULL, 16);
|
||||
if (pkzip->hash.compressed_length > MAX_DATA)
|
||||
{
|
||||
return PARSER_TOKEN_LENGTH;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%x", &(pkzip->hash.crc32));
|
||||
sscanf (p, "%x", & (pkzip->hash.crc32));
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.offset = strtoul(p, NULL, 16);
|
||||
pkzip->hash.offset = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.additional_offset = strtoul(p, NULL, 16);
|
||||
pkzip->hash.additional_offset = strtoul (p, NULL, 16);
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.compression_type = atoi(p);
|
||||
pkzip->hash.compression_type = atoi (p);
|
||||
if (pkzip->hash.compression_type != 0) return PARSER_PKZIP_CT_UNMATCHED;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hash.data_length = strtoul(p, NULL, 16);
|
||||
pkzip->hash.data_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hash.checksum_from_crc));
|
||||
if(pkzip->version == 2)
|
||||
sscanf (p, "%hx", &(pkzip->hash.checksum_from_crc));
|
||||
if (pkzip->version == 2)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hash.checksum_from_timestamp));
|
||||
sscanf (p, "%hx", &(pkzip->hash.checksum_from_timestamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
pkzip->hash.checksum_from_timestamp = pkzip->hash.checksum_from_crc;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
|
||||
hex_to_binary(p, strlen(p), (char *) &(pkzip->hash.data));
|
||||
hex_to_binary (p, strlen (p), (char *) &(pkzip->hash.data));
|
||||
|
||||
// fake salt
|
||||
u32 *ptr = (u32 *) pkzip->hash.data;
|
||||
|
@ -107,8 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$3*1*1*0*8*24*a425*8827*d1730095cd829e245df04ebba6c52c0573d49d3bbeab6cb385b7fa8a28dcccd3098bfdd7*1*0*8*24*2a74*882a*51281ac874a60baedc375ca645888d29780e20d4076edd1e7154a99bde982152a736311f*2*0*e3*1c5*eda7a8de*0*29*8*e3*eda7*5096*1455781b59707f5151139e018bdcfeebfc89bc37e372883a7ec0670a5eafc622feb338f9b021b6601a674094898a91beac70e41e675f77702834ca6156111a1bf7361bc9f3715d77dfcdd626634c68354c6f2e5e0a7b1e1ce84a44e632d0f6e36019feeab92fb7eac9dda8df436e287aafece95d042059a1b27d533c5eab62c1c559af220dc432f2eb1a38a70f29e8f3cb5a207704274d1e305d7402180fd47e026522792f5113c52a116d5bb25b67074ffd6f4926b221555234aabddc69775335d592d5c7d22462b75de1259e8342a9ba71cb06223d13c7f51f13be2ad76352c3b8ed*$/pkzip2$";
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_LEN (32 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
// this is required to force mingw to accept the packed attribute
|
||||
#pragma pack(push,1)
|
||||
@ -126,7 +125,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -187,97 +186,94 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
char input[line_len + 1];
|
||||
input[line_len] = '\0';
|
||||
memcpy(&input, line_buf, line_len);
|
||||
memcpy (&input, line_buf, line_len);
|
||||
|
||||
char *p = strtok(input, "*");
|
||||
char *p = strtok (input, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
|
||||
pkzip->version = 1;
|
||||
if(strlen(p) == 9) pkzip->version = 2;
|
||||
|
||||
if (strlen (p) == 9) pkzip->version = 2;
|
||||
|
||||
char sub[2];
|
||||
sub[0] = p[strlen(p) - 1];
|
||||
sub[0] = p[strlen (p) - 1];
|
||||
sub[1] = '\0';
|
||||
pkzip->hash_count = atoi(sub);
|
||||
pkzip->hash_count = atoi (sub);
|
||||
|
||||
// check here that the hash_count is valid for the attack type
|
||||
if(pkzip->hash_count > 8) return PARSER_HASH_VALUE;
|
||||
if (pkzip->hash_count > 8) return PARSER_HASH_VALUE;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->checksum_size = atoi(p);
|
||||
pkzip->checksum_size = atoi (p);
|
||||
if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH;
|
||||
|
||||
for(int i = 0; i < pkzip->hash_count; i++)
|
||||
for (int i = 0; i < pkzip->hash_count; i++)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].data_type_enum = atoi(p);
|
||||
pkzip->hashes[i].data_type_enum = atoi (p);
|
||||
if (pkzip->hashes[i].data_type_enum > 3) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].magic_type_enum = atoi(p);
|
||||
pkzip->hashes[i].magic_type_enum = atoi (p);
|
||||
|
||||
if(pkzip->hashes[i].data_type_enum > 1)
|
||||
if (pkzip->hashes[i].data_type_enum > 1)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].compressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].compressed_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].uncompressed_length = strtoul (p, NULL, 16);
|
||||
if (pkzip->hashes[i].compressed_length > MAX_DATA)
|
||||
{
|
||||
return PARSER_TOKEN_LENGTH;
|
||||
}
|
||||
if (pkzip->hashes[i].uncompressed_length > MAX_LEN)
|
||||
{
|
||||
return PARSER_HASH_LENGTH;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%x", &(pkzip->hashes[i].crc32));
|
||||
sscanf (p, "%x", &(pkzip->hashes[i].crc32));
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].offset = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].offset = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].additional_offset = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].additional_offset = strtoul (p, NULL, 16);
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].compression_type = atoi(p);
|
||||
pkzip->hashes[i].compression_type = atoi (p);
|
||||
if (pkzip->hashes[i].compression_type != 8) return PARSER_PKZIP_CT_UNMATCHED;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].data_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].data_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_crc));
|
||||
if(pkzip->version == 2)
|
||||
sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_crc));
|
||||
if (pkzip->version == 2)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp));
|
||||
sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
pkzip->hashes[i].checksum_from_timestamp = pkzip->hashes[i].checksum_from_crc;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
|
||||
hex_to_binary(p, strlen(p), (char *) &(pkzip->hashes[i].data));
|
||||
hex_to_binary (p, strlen (p), (char *) &(pkzip->hashes[i].data));
|
||||
|
||||
// fake salt
|
||||
u32 *ptr = (u32 *) pkzip->hashes[i].data;
|
||||
|
@ -107,8 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$3*1*1*0*0*24*3e2c*3ef8*0619e9d17ff3f994065b99b1fa8aef41c056edf9fa4540919c109742dcb32f797fc90ce0*1*0*8*24*431a*3f26*18e2461c0dbad89bd9cc763067a020c89b5e16195b1ac5fa7fb13bd246d000b6833a2988*2*0*23*17*1e3c1a16*2e4*2f*0*23*1e3c*3f2d*54ea4dbc711026561485bbd191bf300ae24fa0997f3779b688cdad323985f8d3bb8b0c*$/pkzip2$";
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_LEN (32 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
// this is required to force mingw to accept the packed attribute
|
||||
#pragma pack(push,1)
|
||||
@ -126,7 +125,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -187,97 +186,94 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
char input[line_len + 1];
|
||||
input[line_len] = '\0';
|
||||
memcpy(&input, line_buf, line_len);
|
||||
memcpy (&input, line_buf, line_len);
|
||||
|
||||
char *p = strtok(input, "*");
|
||||
char *p = strtok (input, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
|
||||
pkzip->version = 1;
|
||||
if(strlen(p) == 9) pkzip->version = 2;
|
||||
|
||||
if (strlen (p) == 9) pkzip->version = 2;
|
||||
|
||||
char sub[2];
|
||||
sub[0] = p[strlen(p) - 1];
|
||||
sub[0] = p[strlen (p) - 1];
|
||||
sub[1] = '\0';
|
||||
pkzip->hash_count = atoi(sub);
|
||||
pkzip->hash_count = atoi (sub);
|
||||
|
||||
// check here that the hash_count is valid for the attack type
|
||||
if(pkzip->hash_count > 8) return PARSER_HASH_VALUE;
|
||||
if (pkzip->hash_count > 8) return PARSER_HASH_VALUE;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->checksum_size = atoi(p);
|
||||
pkzip->checksum_size = atoi (p);
|
||||
if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH;
|
||||
|
||||
for(int i = 0; i < pkzip->hash_count; i++)
|
||||
for (int i = 0; i < pkzip->hash_count; i++)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].data_type_enum = atoi(p);
|
||||
pkzip->hashes[i].data_type_enum = atoi (p);
|
||||
if (pkzip->hashes[i].data_type_enum > 3) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].magic_type_enum = atoi(p);
|
||||
pkzip->hashes[i].magic_type_enum = atoi (p);
|
||||
|
||||
if(pkzip->hashes[i].data_type_enum > 1)
|
||||
if (pkzip->hashes[i].data_type_enum > 1)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].compressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].compressed_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].uncompressed_length = strtoul (p, NULL, 16);
|
||||
if (pkzip->hashes[i].compressed_length > MAX_DATA)
|
||||
{
|
||||
return PARSER_TOKEN_LENGTH;
|
||||
}
|
||||
if (pkzip->hashes[i].uncompressed_length > MAX_LEN)
|
||||
{
|
||||
return PARSER_HASH_LENGTH;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%x", &(pkzip->hashes[i].crc32));
|
||||
sscanf (p, "%x", &(pkzip->hashes[i].crc32));
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].offset = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].offset = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].additional_offset = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].additional_offset = strtoul (p, NULL, 16);
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].compression_type = atoi(p);
|
||||
pkzip->hashes[i].compression_type = atoi (p);
|
||||
if (pkzip->hashes[i].compression_type != 8 && pkzip->hashes[i].compression_type != 0) return PARSER_HASH_VALUE;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].data_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].data_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_crc));
|
||||
if(pkzip->version == 2)
|
||||
sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_crc));
|
||||
if (pkzip->version == 2)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp));
|
||||
sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
pkzip->hashes[i].checksum_from_timestamp = pkzip->hashes[i].checksum_from_crc;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
|
||||
hex_to_binary(p, strlen(p), (char *) &(pkzip->hashes[i].data));
|
||||
hex_to_binary (p, strlen (p), (char *) &(pkzip->hashes[i].data));
|
||||
|
||||
// fake salt
|
||||
u32 *ptr = (u32 *) pkzip->hashes[i].data;
|
||||
|
@ -107,7 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$8*1*1*0*8*24*a425*8827*3bd479d541019c2f32395046b8fbca7e1dca218b9b5414975be49942c3536298e9cc939e*1*0*8*24*2a74*882a*537af57c30fd9fd4b3eefa9ce55b6bff3bbfada237a7c1dace8ebf3bb0de107426211da3*1*0*8*24*2a74*882a*5f406b4858d3489fd4a6a6788798ac9b924b5d0ca8b8e5a6371739c9edcfd28c82f75316*1*0*8*24*2a74*882a*1843aca546b2ea68bd844d1e99d4f74d86417248eb48dd5e956270e42a331c18ea13f5ed*1*0*8*24*2a74*882a*aca3d16543bbfb2e5d2659f63802e0fa5b33e0a1f8ae47334019b4f0b6045d3d8eda3af1*1*0*8*24*2a74*882a*fbe0efc9e10ae1fc9b169bd060470bf3e39f09f8d83bebecd5216de02b81e35fe7e7b2f2*1*0*8*24*2a74*882a*537886dbabffbb7cac77deb01dc84760894524e6966183b4478a4ef56f0c657375a235a1*1*0*8*24*eda7*5096*40eb30ef1ddd9b77b894ed46abf199b480f1e5614fde510855f92ae7b8026a11f80e4d5f*$/pkzip2$";
|
||||
|
||||
#define MAX_DATA (16 * 1024 * 1024)
|
||||
#define MAX_DATA (320 * 1024)
|
||||
|
||||
// this is required to force mingw to accept the packed attribute
|
||||
#pragma pack(push,1)
|
||||
@ -125,7 +125,7 @@ struct pkzip_hash
|
||||
u32 data_length;
|
||||
u16 checksum_from_crc;
|
||||
u16 checksum_from_timestamp;
|
||||
u32 data[MAX_DATA];
|
||||
u32 data[MAX_DATA / 4]; // a quarter because of the u32 type
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
@ -186,94 +186,95 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
char input[line_len + 1];
|
||||
input[line_len] = '\0';
|
||||
memcpy(&input, line_buf, line_len);
|
||||
memcpy (&input, line_buf, line_len);
|
||||
|
||||
char *p = strtok(input, "*");
|
||||
char *p = strtok (input, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED;
|
||||
|
||||
pkzip->version = 1;
|
||||
if(strlen(p) == 9) pkzip->version = 2;
|
||||
|
||||
if (strlen (p) == 9) pkzip->version = 2;
|
||||
|
||||
char sub[2];
|
||||
sub[0] = p[strlen(p) - 1];
|
||||
sub[0] = p[strlen (p) - 1];
|
||||
sub[1] = '\0';
|
||||
pkzip->hash_count = atoi(sub);
|
||||
pkzip->hash_count = atoi (sub);
|
||||
|
||||
// check here that the hash_count is valid for the attack type
|
||||
if(pkzip->hash_count > 8) return PARSER_HASH_VALUE;
|
||||
if(pkzip->hash_count < 3) return PARSER_HASH_VALUE;
|
||||
if (pkzip->hash_count > 8) return PARSER_HASH_VALUE;
|
||||
if (pkzip->hash_count < 3) return PARSER_HASH_VALUE;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->checksum_size = atoi(p);
|
||||
pkzip->checksum_size = atoi (p);
|
||||
if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH;
|
||||
|
||||
for(int i = 0; i < pkzip->hash_count; i++)
|
||||
for (int i = 0; i < pkzip->hash_count; i++)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].data_type_enum = atoi(p);
|
||||
pkzip->hashes[i].data_type_enum = atoi (p);
|
||||
if (pkzip->hashes[i].data_type_enum > 3) return PARSER_HASH_LENGTH;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].magic_type_enum = atoi(p);
|
||||
pkzip->hashes[i].magic_type_enum = atoi (p);
|
||||
|
||||
if(pkzip->hashes[i].data_type_enum > 1)
|
||||
if (pkzip->hashes[i].data_type_enum > 1)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].compressed_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].compressed_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16);
|
||||
if (pkzip->hashes[i].compressed_length > MAX_DATA * 4)
|
||||
pkzip->hashes[i].uncompressed_length = strtoul (p, NULL, 16);
|
||||
if (pkzip->hashes[i].compressed_length > MAX_DATA)
|
||||
{
|
||||
return PARSER_TOKEN_LENGTH;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%x", &(pkzip->hashes[i].crc32));
|
||||
sscanf (p, "%x", &(pkzip->hashes[i].crc32));
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].offset = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].offset = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].additional_offset = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].additional_offset = strtoul (p, NULL, 16);
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].compression_type = atoi(p);
|
||||
pkzip->hashes[i].compression_type = atoi (p);
|
||||
if (pkzip->hashes[i].compression_type != 8 && pkzip->hashes[i].compression_type != 0) return PARSER_PKZIP_CT_UNMATCHED;
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
pkzip->hashes[i].data_length = strtoul(p, NULL, 16);
|
||||
pkzip->hashes[i].data_length = strtoul (p, NULL, 16);
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_crc));
|
||||
if(pkzip->version == 2)
|
||||
sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_crc));
|
||||
if (pkzip->version == 2)
|
||||
{
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp));
|
||||
sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
pkzip->hashes[i].checksum_from_timestamp = pkzip->hashes[i].checksum_from_crc;
|
||||
}
|
||||
|
||||
p = strtok(NULL, "*");
|
||||
p = strtok (NULL, "*");
|
||||
if (p == NULL) return PARSER_HASH_LENGTH;
|
||||
|
||||
hex_to_binary(p, strlen(p), (char *) &(pkzip->hashes[i].data));
|
||||
hex_to_binary (p, strlen (p), (char *) &(pkzip->hashes[i].data));
|
||||
|
||||
// fake salt
|
||||
u32 *ptr = (u32 *) pkzip->hashes[i].data;
|
||||
|
Loading…
Reference in New Issue
Block a user