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.
allium algo, with proper pool diff ratio 256
cleaned up...
- Loading branch information
Showing
8 changed files
with
122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Version 1.3.4 | ||
- Add allium algo | ||
- Add x12 algo | ||
- Add x16s algo | ||
|
||
|
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,103 @@ | ||
/** | ||
* Allium algo Implementation | ||
*/ | ||
|
||
#include <memory.h> | ||
|
||
#include "sha3/sph_blake.h" | ||
#include "sha3/sph_keccak.h" | ||
#include "sha3/sph_cubehash.h" | ||
#include "sha3/sph_skein.h" | ||
#include "sha3/sph_groestl.h" | ||
|
||
#include "lyra2/Lyra2.h" | ||
|
||
#include "miner.h" | ||
|
||
static char* format_hash(char* buf, uint8_t *hash) | ||
{ | ||
int len = 0; | ||
for (int i=0; i < 32; i += 4) { | ||
len += sprintf(buf+len, "%02x%02x%02x%02x ", | ||
hash[i], hash[i+1], hash[i+2], hash[i+3]); | ||
} | ||
return buf; | ||
} | ||
|
||
void allium_hash(void *state, const void *input) | ||
{ | ||
uint32_t hashA[8], hashB[8]; | ||
|
||
sph_blake256_context ctx_blake; | ||
sph_keccak256_context ctx_keccak; | ||
sph_skein256_context ctx_skein; | ||
sph_groestl256_context ctx_groestl; | ||
sph_cubehash256_context ctx_cube; | ||
|
||
// sph_blake256_set_rounds(14); | ||
|
||
sph_blake256_init(&ctx_blake); | ||
sph_blake256(&ctx_blake, input, 80); | ||
sph_blake256_close(&ctx_blake, hashA); | ||
|
||
sph_keccak256_init(&ctx_keccak); | ||
sph_keccak256(&ctx_keccak, hashA, 32); | ||
sph_keccak256_close(&ctx_keccak, hashB); | ||
|
||
LYRA2(hashA, 32, hashB, 32, hashB, 32, 1, 8, 8); | ||
|
||
sph_cubehash256_init(&ctx_cube); | ||
sph_cubehash256(&ctx_cube, hashA, 32); | ||
sph_cubehash256_close(&ctx_cube, hashB); | ||
|
||
LYRA2(hashA, 32, hashB, 32, hashB, 32, 1, 8, 8); | ||
|
||
sph_skein256_init(&ctx_skein); | ||
sph_skein256(&ctx_skein, hashA, 32); | ||
sph_skein256_close(&ctx_skein, hashB); | ||
|
||
sph_groestl256_init(&ctx_groestl); | ||
sph_groestl256(&ctx_groestl, hashB, 32); | ||
sph_groestl256_close(&ctx_groestl, hashA); | ||
|
||
memcpy(state, hashA, 32); | ||
} | ||
|
||
int scanhash_allium(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) | ||
{ | ||
uint32_t _ALIGN(128) hash[8]; | ||
uint32_t _ALIGN(128) endiandata[20]; | ||
uint32_t *pdata = work->data; | ||
uint32_t *ptarget = work->target; | ||
|
||
const uint32_t Htarg = ptarget[7]; | ||
const uint32_t first_nonce = pdata[19]; | ||
uint32_t n = first_nonce; | ||
|
||
if(opt_benchmark){ | ||
ptarget[7] = 0x00ff; | ||
} | ||
|
||
for (int i=0; i < 19; i++) { | ||
be32enc(&endiandata[i], pdata[i]); | ||
} | ||
|
||
do { | ||
be32enc(&endiandata[19], n); | ||
allium_hash(hash, endiandata); | ||
|
||
if (hash[7] < Htarg && fulltest(hash, ptarget)) { | ||
work_set_target_ratio(work, hash); | ||
*hashes_done = n - first_nonce + 1; | ||
pdata[19] = n; | ||
return 1; | ||
} | ||
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