From 2814f8555edb1c3721d9269cab2d772dead10cd4 Mon Sep 17 00:00:00 2001 From: WO Date: Sun, 2 Dec 2018 10:29:33 +0900 Subject: [PATCH] Fix yescrypt_hash function for Sapling --- yescrypt.c | 2 +- yescrypt.h | 4 ++-- yescryptcommon.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/yescrypt.c b/yescrypt.c index 19392f99f..29bed4c2e 100644 --- a/yescrypt.c +++ b/yescrypt.c @@ -31,7 +31,7 @@ int scanhash_yescrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, do { pdata[19] = ++n; be32enc(&endiandata[19], n); - yescrypt_hash_sp((unsigned char*) &endiandata, (unsigned char*) hash64); + yescrypt_hash_sp((unsigned char*) &endiandata, perslen, (unsigned char*) hash64); if ((hash64[7] < ptarget[7]) || ((hash64[7] == ptarget[7]) && (hash64[6] < ptarget[6])) && fulltest(hash64, ptarget)) { *hashes_done = n - first_nonce + 1; diff --git a/yescrypt.h b/yescrypt.h index 8fb8b0e24..cdc2a31af 100755 --- a/yescrypt.h +++ b/yescrypt.h @@ -38,8 +38,8 @@ extern "C" { #endif -extern void yescrypt_hash_sp(const char *input, char *output); -extern void yescrypt_hash(const char *input, char *output); +extern void yescrypt_hash_sp(const char *input, int inputlen, char *output); +extern void yescrypt_hash(const char *input, int inputlen, char *output); diff --git a/yescryptcommon.c b/yescryptcommon.c index c0d09185c..f57d132fe 100755 --- a/yescryptcommon.c +++ b/yescryptcommon.c @@ -363,12 +363,12 @@ yescrypt_bsty(const uint8_t * passwd, size_t passwdlen, return retval; } -void yescrypt_hash_sp(const char *input, char *output) +void yescrypt_hash_sp(const char *input, int inputlen, char *output) { - yescrypt_bsty((const uint8_t *)input, 80, (const uint8_t *) input, 80, 2048, 8, 1, (uint8_t *)output, 32); + yescrypt_bsty((const uint8_t *)input, inputlen, (const uint8_t *) input, inputlen, 2048, 8, 1, (uint8_t *)output, 32); } -void yescrypt_hash(const char *input, char *output) +void yescrypt_hash(const char *input, int inputlen, char *output) { - yescrypt_hash_sp(input, output); + yescrypt_hash_sp(input, inputlen, output); }