Skip to content
This repository was archived by the owner on Jan 9, 2021. It is now read-only.

Commit fb9b8a3

Browse files
Merge pull request #5 from nicehash/develop
Blake algo + fixes
2 parents ca3f9d5 + e75e16c commit fb9b8a3

30 files changed

+2085
-306
lines changed

Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ sgminer_SOURCES += algorithm/whirlcoin.c algorithm/whirlcoin.h
7373
sgminer_SOURCES += algorithm/neoscrypt.c algorithm/neoscrypt.h
7474
sgminer_SOURCES += algorithm/whirlpoolx.c algorithm/whirlpoolx.h
7575
sgminer_SOURCES += algorithm/lyra2re.c algorithm/lyra2re.h algorithm/lyra2.c algorithm/lyra2.h algorithm/sponge.c algorithm/sponge.h
76-
sgminer_SOURCES += algorithm/lyra2re_old.c algorithm/lyra2re_old.h
76+
sgminer_SOURCES += algorithm/lyra2rev2.c algorithm/lyra2rev2.h
7777
sgminer_SOURCES += algorithm/pluck.c algorithm/pluck.h
7878
sgminer_SOURCES += algorithm/credits.c algorithm/credits.h
7979
sgminer_SOURCES += algorithm/yescrypt.h algorithm/yescrypt.c algorithm/yescrypt_core.h algorithm/yescrypt-opt.c algorithm/yescryptcommon.c algorithm/sysendian.h
80+
sgminer_SOURCES += algorithm/blake256.c algorithm/blake256.h
81+
sgminer_SOURCES += algorithm/blakecoin.c algorithm/blakecoin.h
8082

8183
bin_SCRIPTS = $(top_srcdir)/kernel/*.cl
8284

algorithm.c

Lines changed: 71 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
#include "algorithm/neoscrypt.h"
3434
#include "algorithm/whirlpoolx.h"
3535
#include "algorithm/lyra2re.h"
36-
#include "algorithm/lyra2re_old.h"
36+
#include "algorithm/lyra2rev2.h"
3737
#include "algorithm/pluck.h"
3838
#include "algorithm/yescrypt.h"
3939
#include "algorithm/credits.h"
40+
#include "algorithm/blake256.h"
41+
#include "algorithm/blakecoin.h"
4042

4143
#include "compat.h"
4244

@@ -62,10 +64,13 @@ const char *algorithm_type_str[] = {
6264
"Neoscrypt",
6365
"WhirlpoolX",
6466
"Lyra2RE",
65-
"Lyra2REv2"
67+
"Lyra2REV2"
6668
"Pluck"
6769
"Yescrypt",
68-
"Yescrypt-multi"
70+
"Yescrypt-multi",
71+
"Blakecoin",
72+
"Blake",
73+
"Vanilla"
6974
};
7075

7176
void sha256(const unsigned char *message, unsigned int len, unsigned char *digest)
@@ -798,7 +803,7 @@ static cl_int queue_whirlpoolx_kernel(struct __clState *clState, struct _dev_blk
798803
return status;
799804
}
800805

801-
static cl_int queue_lyra2RE_kernel(struct __clState *clState, struct _dev_blk_ctx *blk, __maybe_unused cl_uint threads)
806+
static cl_int queue_lyra2re_kernel(struct __clState *clState, struct _dev_blk_ctx *blk, __maybe_unused cl_uint threads)
802807
{
803808
cl_kernel *kernel;
804809
unsigned int num;
@@ -842,7 +847,7 @@ static cl_int queue_lyra2RE_kernel(struct __clState *clState, struct _dev_blk_ct
842847
return status;
843848
}
844849

845-
static cl_int queue_lyra2REv2_kernel(struct __clState *clState, struct _dev_blk_ctx *blk, __maybe_unused cl_uint threads)
850+
static cl_int queue_lyra2rev2_kernel(struct __clState *clState, struct _dev_blk_ctx *blk, __maybe_unused cl_uint threads)
846851
{
847852
cl_kernel *kernel;
848853
unsigned int num;
@@ -915,10 +920,38 @@ static cl_int queue_pluck_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_un
915920
return status;
916921
}
917922

923+
static cl_int queue_blake_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_unused cl_uint threads)
924+
{
925+
cl_kernel *kernel = &clState->kernel;
926+
unsigned int num = 0;
927+
cl_int status = 0;
928+
cl_ulong le_target;
929+
930+
le_target = *(cl_ulong *)(blk->work->device_target + 24);
931+
flip80(clState->cldata, blk->work->data);
932+
status = clEnqueueWriteBuffer(clState->commandQueue, clState->CLbuffer0, true, 0, 80, clState->cldata, 0, NULL, NULL);
933+
934+
CL_SET_ARG(clState->outputBuffer);
935+
CL_SET_ARG(blk->work->blk.ctx_a);
936+
CL_SET_ARG(blk->work->blk.ctx_b);
937+
CL_SET_ARG(blk->work->blk.ctx_c);
938+
CL_SET_ARG(blk->work->blk.ctx_d);
939+
CL_SET_ARG(blk->work->blk.ctx_e);
940+
CL_SET_ARG(blk->work->blk.ctx_f);
941+
CL_SET_ARG(blk->work->blk.ctx_g);
942+
CL_SET_ARG(blk->work->blk.ctx_h);
943+
944+
CL_SET_ARG(blk->work->blk.cty_a);
945+
CL_SET_ARG(blk->work->blk.cty_b);
946+
CL_SET_ARG(blk->work->blk.cty_c);
947+
948+
return status;
949+
}
950+
918951
static algorithm_settings_t algos[] = {
919952
// kernels starting from this will have difficulty calculated by using litecoin algorithm
920953
#define A_SCRYPT(a) \
921-
{ a, ALGO_SCRYPT, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFFFFFFULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, scrypt_regenhash, queue_scrypt_kernel, gen_hash, append_scrypt_compiler_options }
954+
{ a, ALGO_SCRYPT, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFFFFFFULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, scrypt_regenhash, NULL, queue_scrypt_kernel, gen_hash, append_scrypt_compiler_options }
922955
A_SCRYPT("ckolivas"),
923956
A_SCRYPT("alexkarnew"),
924957
A_SCRYPT("alexkarnold"),
@@ -929,36 +962,33 @@ static algorithm_settings_t algos[] = {
929962
#undef A_SCRYPT
930963

931964
#define A_NEOSCRYPT(a) \
932-
{ a, ALGO_NEOSCRYPT, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, neoscrypt_regenhash, queue_neoscrypt_kernel, gen_hash, append_neoscrypt_compiler_options }
965+
{ a, ALGO_NEOSCRYPT, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, neoscrypt_regenhash, NULL, queue_neoscrypt_kernel, gen_hash, append_neoscrypt_compiler_options }
933966
A_NEOSCRYPT("neoscrypt"),
934967
#undef A_NEOSCRYPT
935968

936969
#define A_PLUCK(a) \
937-
{ a, ALGO_PLUCK, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, pluck_regenhash, queue_pluck_kernel, gen_hash, append_neoscrypt_compiler_options }
970+
{ a, ALGO_PLUCK, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, pluck_regenhash, NULL, queue_pluck_kernel, gen_hash, append_neoscrypt_compiler_options }
938971
A_PLUCK("pluck"),
939972
#undef A_PLUCK
940973

941974
#define A_CREDITS(a) \
942-
{ a, ALGO_CRE, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, credits_regenhash, queue_credits_kernel, gen_hash, NULL}
975+
{ a, ALGO_CRE, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, credits_regenhash, NULL, queue_credits_kernel, gen_hash, NULL}
943976
A_CREDITS("credits"),
944977
#undef A_CREDITS
945978

946-
947-
948979
#define A_YESCRYPT(a) \
949-
{ a, ALGO_YESCRYPT, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, yescrypt_regenhash, queue_yescrypt_kernel, gen_hash, append_neoscrypt_compiler_options}
980+
{ a, ALGO_YESCRYPT, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 0, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, yescrypt_regenhash, NULL, queue_yescrypt_kernel, gen_hash, append_neoscrypt_compiler_options}
950981
A_YESCRYPT("yescrypt"),
951982
#undef A_YESCRYPT
952983

953984
#define A_YESCRYPT_MULTI(a) \
954-
{ a, ALGO_YESCRYPT_MULTI, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 6,-1,CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , yescrypt_regenhash, queue_yescrypt_multikernel, gen_hash, append_neoscrypt_compiler_options}
985+
{ a, ALGO_YESCRYPT_MULTI, "", 1, 65536, 65536, 0, 0, 0xFF, 0xFFFF000000000000ULL, 0x0000ffffUL, 6,-1,CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , yescrypt_regenhash, NULL, queue_yescrypt_multikernel, gen_hash, append_neoscrypt_compiler_options}
955986
A_YESCRYPT_MULTI("yescrypt-multi"),
956987
#undef A_YESCRYPT_MULTI
957988

958-
959989
// kernels starting from this will have difficulty calculated by using quarkcoin algorithm
960990
#define A_QUARK(a, b) \
961-
{ a, ALGO_QUARK, "", 256, 256, 256, 0, 0, 0xFF, 0xFFFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, b, queue_sph_kernel, gen_hash, append_x11_compiler_options }
991+
{ a, ALGO_QUARK, "", 256, 256, 256, 0, 0, 0xFF, 0xFFFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, b, NULL, queue_sph_kernel, gen_hash, append_x11_compiler_options }
962992
A_QUARK("quarkcoin", quarkcoin_regenhash),
963993
A_QUARK("qubitcoin", qubitcoin_regenhash),
964994
A_QUARK("animecoin", animecoin_regenhash),
@@ -967,46 +997,48 @@ static algorithm_settings_t algos[] = {
967997

968998
// kernels starting from this will have difficulty calculated by using bitcoin algorithm
969999
#define A_DARK(a, b) \
970-
{ a, ALGO_X11, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, b, queue_sph_kernel, gen_hash, append_x11_compiler_options }
1000+
{ a, ALGO_X11, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, b, NULL, queue_sph_kernel, gen_hash, append_x11_compiler_options }
9711001
A_DARK("darkcoin", darkcoin_regenhash),
9721002
A_DARK("inkcoin", inkcoin_regenhash),
9731003
A_DARK("myriadcoin-groestl", myriadcoin_groestl_regenhash),
9741004
#undef A_DARK
9751005

976-
{ "twecoin", ALGO_TWE, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, twecoin_regenhash, queue_sph_kernel, sha256, NULL },
977-
{ "maxcoin", ALGO_KECCAK, "", 1, 256, 1, 4, 15, 0x0F, 0xFFFFULL, 0x000000ffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, maxcoin_regenhash, queue_maxcoin_kernel, sha256, NULL },
978-
979-
{ "darkcoin-mod", ALGO_X11, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 8 * 16 * 4194304, 0, darkcoin_regenhash, queue_darkcoin_mod_kernel, gen_hash, append_x11_compiler_options },
1006+
{ "twecoin", ALGO_TWE, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, twecoin_regenhash, NULL, queue_sph_kernel, sha256, NULL },
1007+
{ "maxcoin", ALGO_KECCAK, "", 1, 256, 1, 4, 15, 0x0F, 0xFFFFULL, 0x000000ffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, maxcoin_regenhash, NULL, queue_maxcoin_kernel, sha256, NULL },
9801008

981-
{ "marucoin", ALGO_X13, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, marucoin_regenhash, queue_sph_kernel, gen_hash, append_x13_compiler_options },
982-
{ "marucoin-mod", ALGO_X13, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 12, 8 * 16 * 4194304, 0, marucoin_regenhash, queue_marucoin_mod_kernel, gen_hash, append_x13_compiler_options },
983-
{ "marucoin-modold", ALGO_X13, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 8 * 16 * 4194304, 0, marucoin_regenhash, queue_marucoin_mod_old_kernel, gen_hash, append_x13_compiler_options },
1009+
{ "darkcoin-mod", ALGO_X11, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 8 * 16 * 4194304, 0, darkcoin_regenhash, NULL, queue_darkcoin_mod_kernel, gen_hash, append_x11_compiler_options },
9841010

985-
{ "x14", ALGO_X14, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 13, 8 * 16 * 4194304, 0, x14_regenhash, queue_x14_kernel, gen_hash, append_x13_compiler_options },
986-
{ "x14old", ALGO_X14, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 8 * 16 * 4194304, 0, x14_regenhash, queue_x14_old_kernel, gen_hash, append_x13_compiler_options },
1011+
{ "marucoin", ALGO_X13, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, marucoin_regenhash, NULL, queue_sph_kernel, gen_hash, append_x13_compiler_options },
1012+
{ "marucoin-mod", ALGO_X13, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 12, 8 * 16 * 4194304, 0, marucoin_regenhash, NULL, queue_marucoin_mod_kernel, gen_hash, append_x13_compiler_options },
1013+
{ "marucoin-modold", ALGO_X13, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 8 * 16 * 4194304, 0, marucoin_regenhash, NULL, queue_marucoin_mod_old_kernel, gen_hash, append_x13_compiler_options },
9871014

988-
{ "bitblock", ALGO_X15, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 14, 4 * 16 * 4194304, 0, bitblock_regenhash, queue_bitblock_kernel, gen_hash, append_x13_compiler_options },
989-
{ "bitblockold", ALGO_X15, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 4 * 16 * 4194304, 0, bitblock_regenhash, queue_bitblockold_kernel, gen_hash, append_x13_compiler_options },
1015+
{ "x14", ALGO_X14, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 13, 8 * 16 * 4194304, 0, x14_regenhash, NULL, queue_x14_kernel, gen_hash, append_x13_compiler_options },
1016+
{ "x14old", ALGO_X14, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 8 * 16 * 4194304, 0, x14_regenhash, NULL, queue_x14_old_kernel, gen_hash, append_x13_compiler_options },
9901017

991-
{ "talkcoin-mod", ALGO_NIST, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 4, 8 * 16 * 4194304, 0, talkcoin_regenhash, queue_talkcoin_mod_kernel, gen_hash, append_x11_compiler_options },
1018+
{ "bitblock", ALGO_X15, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 14, 4 * 16 * 4194304, 0, bitblock_regenhash, NULL, queue_bitblock_kernel, gen_hash, append_x13_compiler_options },
1019+
{ "bitblockold", ALGO_X15, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 10, 4 * 16 * 4194304, 0, bitblock_regenhash, NULL, queue_bitblockold_kernel, gen_hash, append_x13_compiler_options },
9921020

993-
{ "fresh", ALGO_FRESH, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 4, 4 * 16 * 4194304, 0, fresh_regenhash, queue_fresh_kernel, gen_hash, NULL },
1021+
{ "talkcoin-mod", ALGO_NIST, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 4, 8 * 16 * 4194304, 0, talkcoin_regenhash, NULL, queue_talkcoin_mod_kernel, gen_hash, append_x11_compiler_options },
9941022

995-
{ "lyra2re", ALGO_LYRA2RE, "", 1, 128, 128, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 4, 2 * 8 * 4194304, 0, lyra2reold_regenhash, queue_lyra2RE_kernel, gen_hash, NULL },
996-
997-
{ "lyra2rev2", ALGO_LYRA2REv2, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 6, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, lyra2re_regenhash, queue_lyra2REv2_kernel, gen_hash, append_neoscrypt_compiler_options },
1023+
{ "fresh", ALGO_FRESH, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 4, 4 * 16 * 4194304, 0, fresh_regenhash, NULL, queue_fresh_kernel, gen_hash, NULL },
9981024

1025+
{ "lyra2re", ALGO_LYRA2RE, "", 1, 128, 128, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 4, 2 * 8 * 4194304, 0, lyra2re_regenhash, precalc_hash_blake256, queue_lyra2re_kernel, gen_hash, NULL },
1026+
{ "lyra2rev2", ALGO_LYRA2REV2, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 6, -1, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, lyra2rev2_regenhash, precalc_hash_blake256, queue_lyra2rev2_kernel, gen_hash, append_neoscrypt_compiler_options },
9991027

10001028
// kernels starting from this will have difficulty calculated by using fuguecoin algorithm
10011029
#define A_FUGUE(a, b, c) \
1002-
{ a, ALGO_FUGUE, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, b, queue_sph_kernel, c, NULL }
1030+
{ a, ALGO_FUGUE, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, b, NULL, queue_sph_kernel, c, NULL }
10031031
A_FUGUE("fuguecoin", fuguecoin_regenhash, sha256),
10041032
A_FUGUE("groestlcoin", groestlcoin_regenhash, sha256),
10051033
A_FUGUE("diamond", groestlcoin_regenhash, gen_hash),
10061034
#undef A_FUGUE
10071035

1008-
{ "whirlcoin", ALGO_WHIRL, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 3, 8 * 16 * 4194304, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, whirlcoin_regenhash, queue_whirlcoin_kernel, sha256, NULL },
1009-
{ "whirlpoolx", ALGO_WHIRLPOOLX, "", 1, 1, 1, 0, 0, 0xFFU, 0xFFFFULL, 0x0000FFFFUL, 0, 0, 0, whirlpoolx_regenhash, queue_whirlpoolx_kernel, gen_hash, NULL },
1036+
{ "whirlcoin", ALGO_WHIRL, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 3, 8 * 16 * 4194304, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, whirlcoin_regenhash, NULL, queue_whirlcoin_kernel, sha256, NULL },
1037+
{ "whirlpoolx", ALGO_WHIRLPOOLX, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000FFFFUL, 0, 0, 0, whirlpoolx_regenhash, NULL, queue_whirlpoolx_kernel, gen_hash, NULL },
1038+
1039+
{ "blake256r8", ALGO_BLAKECOIN, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x000000ffUL, 0, 128, 0, blakecoin_regenhash, precalc_hash_blakecoin, queue_blake_kernel, sha256, NULL },
1040+
{ "blake256r14", ALGO_BLAKE, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x00000000UL, 0, 128, 0, blake256_regenhash, precalc_hash_blake256, queue_blake_kernel, gen_hash, NULL },
1041+
{ "vanilla", ALGO_VANILLA, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x000000ffUL, 0, 128, 0, blakecoin_regenhash, precalc_hash_blakecoin, queue_blake_kernel, gen_hash, NULL },
10101042

10111043
// Terminator (do not remove)
10121044
{ NULL, ALGO_UNK, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL }
@@ -1019,7 +1051,7 @@ void copy_algorithm_settings(algorithm_t* dest, const char* algo)
10191051
// Find algorithm settings and copy
10201052
for (src = algos; src->name; src++)
10211053
{
1022-
if (strcmp(src->name, algo) == 0)
1054+
if (strcasecmp(src->name, algo) == 0)
10231055
{
10241056
strcpy(dest->name, src->name);
10251057
dest->kernelfile = src->kernelfile;
@@ -1037,6 +1069,7 @@ void copy_algorithm_settings(algorithm_t* dest, const char* algo)
10371069
dest->rw_buffer_size = src->rw_buffer_size;
10381070
dest->cq_properties = src->cq_properties;
10391071
dest->regenhash = src->regenhash;
1072+
dest->precalc_hash = src->precalc_hash;
10401073
dest->queue_kernel = src->queue_kernel;
10411074
dest->gen_hash = src->gen_hash;
10421075
dest->set_compile_options = src->set_compile_options;
@@ -1081,6 +1114,8 @@ static const char *lookup_algorithm_alias(const char *lookup_alias, uint8_t *nfa
10811114
ALGO_ALIAS("whirlpool", "whirlcoin");
10821115
ALGO_ALIAS("lyra2", "lyra2re");
10831116
ALGO_ALIAS("lyra2v2", "lyra2rev2");
1117+
ALGO_ALIAS("blakecoin", "blake256r8");
1118+
ALGO_ALIAS("blake", "blake256r14");
10841119

10851120
#undef ALGO_ALIAS
10861121
#undef ALGO_ALIAS_NF

algorithm.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ typedef enum {
3030
ALGO_NEOSCRYPT,
3131
ALGO_WHIRLPOOLX,
3232
ALGO_LYRA2RE,
33-
ALGO_LYRA2REv2,
33+
ALGO_LYRA2REV2,
3434
ALGO_PLUCK,
3535
ALGO_YESCRYPT,
3636
ALGO_YESCRYPT_MULTI,
37+
ALGO_BLAKECOIN,
38+
ALGO_BLAKE,
39+
ALGO_VANILLA
3740
} algorithm_type_t;
3841

3942
extern const char *algorithm_type_str[];
@@ -67,6 +70,7 @@ typedef struct _algorithm_t {
6770
long rw_buffer_size;
6871
cl_command_queue_properties cq_properties;
6972
void(*regenhash)(struct work *);
73+
void(*precalc_hash)(struct _dev_blk_ctx *, uint32_t *, uint32_t *);
7074
cl_int(*queue_kernel)(struct __clState *, struct _dev_blk_ctx *, cl_uint);
7175
void(*gen_hash)(const unsigned char *, unsigned int, unsigned char *);
7276
void(*set_compile_options)(struct _build_kernel_data *, struct cgpu_info *, struct _algorithm_t *);
@@ -89,6 +93,7 @@ typedef struct _algorithm_settings_t
8993
long rw_buffer_size;
9094
cl_command_queue_properties cq_properties;
9195
void (*regenhash)(struct work *);
96+
void (*precalc_hash)(struct _dev_blk_ctx *, uint32_t *, uint32_t *);
9297
cl_int (*queue_kernel)(struct __clState *, struct _dev_blk_ctx *, cl_uint);
9398
void (*gen_hash)(const unsigned char *, unsigned int, unsigned char *);
9499
void (*set_compile_options)(build_kernel_data *, struct cgpu_info *, algorithm_t *);

0 commit comments

Comments
 (0)