forked from tpruvot/cpuminer-multi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add double skein (skein2) algo for Woodcoin
- Loading branch information
Showing
9 changed files
with
103 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "miner.h" | ||
|
||
#include <string.h> | ||
#include <stdint.h> | ||
|
||
#include "sha3/sph_skein.h" | ||
|
||
void skein2hash(void *output, const void *input) | ||
{ | ||
sph_skein512_context ctx_skein; | ||
|
||
uint32_t hash[16]; | ||
|
||
sph_skein512_init(&ctx_skein); | ||
sph_skein512(&ctx_skein, input, 80); | ||
sph_skein512_close(&ctx_skein, hash); | ||
|
||
sph_skein512_init(&ctx_skein); | ||
sph_skein512(&ctx_skein, hash, 64); | ||
sph_skein512_close(&ctx_skein, hash); | ||
|
||
memcpy(output, hash, 32); | ||
} | ||
|
||
int scanhash_skein2(int thr_id, uint32_t *pdata, const uint32_t *ptarget, | ||
uint32_t max_nonce, uint64_t *hashes_done) | ||
{ | ||
uint32_t _ALIGN(64) hash64[8]; | ||
uint32_t _ALIGN(64) endiandata[20]; | ||
|
||
const uint32_t Htarg = ptarget[7]; | ||
const uint32_t first_nonce = pdata[19]; | ||
|
||
uint32_t n = first_nonce; | ||
|
||
for (int i=0; i < 19; i++) { | ||
be32enc(&endiandata[i], pdata[i]); | ||
}; | ||
|
||
do { | ||
be32enc(&endiandata[19], n); | ||
skein2hash(hash64, endiandata); | ||
if (hash64[7] < Htarg && fulltest(hash64, ptarget)) { | ||
*hashes_done = n - first_nonce + 1; | ||
pdata[19] = n; | ||
return true; | ||
} | ||
n++; | ||
|
||
} while (n < max_nonce && !work_restart[thr_id].restart); | ||
|
||
*hashes_done = n - first_nonce + 1; | ||
pdata[19] = n; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters