Skip to content

Commit 2814f85

Browse files
committed
Fix yescrypt_hash function for Sapling
1 parent 8e71bf5 commit 2814f85

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

yescrypt.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int scanhash_yescrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
3131
do {
3232
pdata[19] = ++n;
3333
be32enc(&endiandata[19], n);
34-
yescrypt_hash_sp((unsigned char*) &endiandata, (unsigned char*) hash64);
34+
yescrypt_hash_sp((unsigned char*) &endiandata, perslen, (unsigned char*) hash64);
3535
if ((hash64[7] < ptarget[7]) || ((hash64[7] == ptarget[7]) && (hash64[6] < ptarget[6])) &&
3636
fulltest(hash64, ptarget)) {
3737
*hashes_done = n - first_nonce + 1;

yescrypt.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ extern "C" {
3838
#endif
3939

4040

41-
extern void yescrypt_hash_sp(const char *input, char *output);
42-
extern void yescrypt_hash(const char *input, char *output);
41+
extern void yescrypt_hash_sp(const char *input, int inputlen, char *output);
42+
extern void yescrypt_hash(const char *input, int inputlen, char *output);
4343

4444

4545

yescryptcommon.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,12 @@ yescrypt_bsty(const uint8_t * passwd, size_t passwdlen,
363363
return retval;
364364
}
365365

366-
void yescrypt_hash_sp(const char *input, char *output)
366+
void yescrypt_hash_sp(const char *input, int inputlen, char *output)
367367
{
368-
yescrypt_bsty((const uint8_t *)input, 80, (const uint8_t *) input, 80, 2048, 8, 1, (uint8_t *)output, 32);
368+
yescrypt_bsty((const uint8_t *)input, inputlen, (const uint8_t *) input, inputlen, 2048, 8, 1, (uint8_t *)output, 32);
369369
}
370370

371-
void yescrypt_hash(const char *input, char *output)
371+
void yescrypt_hash(const char *input, int inputlen, char *output)
372372
{
373-
yescrypt_hash_sp(input, output);
373+
yescrypt_hash_sp(input, inputlen, output);
374374
}

0 commit comments

Comments
 (0)