Skip to content

Commit

Permalink
Fix yescrypt_hash function for Sapling
Browse files Browse the repository at this point in the history
  • Loading branch information
wo01 committed Dec 2, 2018
1 parent 8e71bf5 commit 2814f85
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion yescrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions yescrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);



Expand Down
8 changes: 4 additions & 4 deletions yescryptcommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 2814f85

Please sign in to comment.