diff options
author | Jeff Garzik <jeff@garzik.org> | 2011-01-29 00:56:24 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2011-01-29 00:56:24 -0500 |
commit | 0b677407076a55c6a758d1414fade617abd552e5 (patch) | |
tree | 193288f726bf0d89579deefe7d787088d2e8cf6f /sha256_cryptopp.c | |
parent | f570ffcf75764398c9682c310ad7420acd7593c2 (diff) |
Pass max-nonce as arg to each sha256 algo.
Should be an equivalent transformation, with no behavior changes.
Diffstat (limited to 'sha256_cryptopp.c')
-rw-r--r-- | sha256_cryptopp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sha256_cryptopp.c b/sha256_cryptopp.c index c42eaf5..1535b6b 100644 --- a/sha256_cryptopp.c +++ b/sha256_cryptopp.c @@ -93,7 +93,7 @@ static void runhash(void *state, const void *input, const void *init) /* suspiciously similar to ScanHash* from bitcoin */ bool scanhash_cryptopp(const unsigned char *midstate, unsigned char *data, unsigned char *hash1, unsigned char *hash, - unsigned long *hashes_done) + uint32_t max_nonce, unsigned long *hashes_done) { uint32_t *hash32 = (uint32_t *) hash; uint32_t *nonce = (uint32_t *)(data + 12); @@ -122,7 +122,7 @@ bool scanhash_cryptopp(const unsigned char *midstate, unsigned char *data, return true; } - if ((n & 0xffffff) == 0) { + if (n >= max_nonce) { if (opt_debug) fprintf(stderr, "DBG: end of nonce range\n"); *hashes_done = stat_ctr; @@ -584,7 +584,7 @@ static void runhash32(void *state, const void *input, const void *init) /* suspiciously similar to ScanHash* from bitcoin */ bool scanhash_asm32(const unsigned char *midstate, unsigned char *data, unsigned char *hash1, unsigned char *hash, - unsigned long *hashes_done) + uint32_t max_nonce, unsigned long *hashes_done) { uint32_t *hash32 = (uint32_t *) hash; uint32_t *nonce = (uint32_t *)(data + 12); @@ -613,7 +613,7 @@ bool scanhash_asm32(const unsigned char *midstate, unsigned char *data, return true; } - if ((n & 0xffffff) == 0) { + if (n >= max_nonce) { if (opt_debug) fprintf(stderr, "DBG: end of nonce range\n"); *hashes_done = stat_ctr; |