Skip to content

Commit

Permalink
Merge pull request fireice-uk#2316 from psychocrypt/topic-cryptonight…
Browse files Browse the repository at this point in the history
…V8Double

add cryptonight_v8_double
  • Loading branch information
fireice-uk authored Mar 11, 2019
2 parents 58d232f + 00da146 commit fdaefd7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Besides [Monero](https://getmonero.org), following coins can be mined using this
- [Stellite](https://stellite.cash/)
- [TurtleCoin](https://turtlecoin.lol)
- [Zelerius](https://zelerius.org/)
- [X-CASH](https://x-network.io/)

Ryo currency is a way for us to implement the ideas that we were unable to in
Monero. See [here](https://github.com/fireice-uk/cryptonote-speedup-demo/) for details.
Expand All @@ -70,6 +71,7 @@ If your prefered coin is not listed, you can choose one of the following algorit
- cryptonight_v7
- cryptonight_v7_stellite
- cryptonight_v8
- cryptonight_v8_double (used by X-CASH)
- cryptonight_v8_half (used by masari and stellite)
- cryptonight_v8_reversewaltz (used by graft)
- cryptonight_v8_zelerius
Expand Down
14 changes: 12 additions & 2 deletions xmrstak/backend/cpu/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,21 @@ bool minethd::self_test()
{
func_selector(ctx, ::jconf::inst()->HaveHardwareAes(), false, algo);
ctx[0]->hash_fn("This is a test This is a test This is a test", 44, out, ctx, algo);
bResult = memcmp(out, "\x32\xf7\x36\xec\x1d\x2f\x3f\xc5\x4c\x49\xbe\xb8\xa0\x47\x6c\xbf\xdd\x14\xc3\x51\xb9\xc6\xd7\x2c\x6f\x9f\xfc\xb5\x87\x5b\xe6\xb3", 32) == 0;
bResult = bResult && memcmp(out, "\x32\xf7\x36\xec\x1d\x2f\x3f\xc5\x4c\x49\xbe\xb8\xa0\x47\x6c\xbf\xdd\x14\xc3\x51\xb9\xc6\xd7\x2c\x6f\x9f\xfc\xb5\x87\x5b\xe6\xb3", 32) == 0;

func_selector(ctx, ::jconf::inst()->HaveHardwareAes(), true, algo);
ctx[0]->hash_fn("This is a test This is a test This is a test", 44, out, ctx, algo);
bResult &= memcmp(out, "\x32\xf7\x36\xec\x1d\x2f\x3f\xc5\x4c\x49\xbe\xb8\xa0\x47\x6c\xbf\xdd\x14\xc3\x51\xb9\xc6\xd7\x2c\x6f\x9f\xfc\xb5\x87\x5b\xe6\xb3", 32) == 0;
bResult = bResult && memcmp(out, "\x32\xf7\x36\xec\x1d\x2f\x3f\xc5\x4c\x49\xbe\xb8\xa0\x47\x6c\xbf\xdd\x14\xc3\x51\xb9\xc6\xd7\x2c\x6f\x9f\xfc\xb5\x87\x5b\xe6\xb3", 32) == 0;
}
else if(algo == POW(cryptonight_v8_double))
{
func_selector(ctx, ::jconf::inst()->HaveHardwareAes(), false, algo);
ctx[0]->hash_fn("This is a test This is a test This is a test", 44, out, ctx, algo);
bResult = bResult && memcmp(out, "\x63\x43\x8e\xd\x5c\x18\xff\xca\xd5\xb5\xdf\xe0\x26\x8a\x5b\x3f\xe9\xbc\x1\xef\xe6\x3a\xd3\x4f\x2c\x57\x1c\xda\xb2\xc\x32\x31", 32) == 0;

func_selector(ctx, ::jconf::inst()->HaveHardwareAes(), true, algo);
ctx[0]->hash_fn("This is a test This is a test This is a test", 44, out, ctx, algo);
bResult = bResult && memcmp(out, "\x63\x43\x8e\xd\x5c\x18\xff\xca\xd5\xb5\xdf\xe0\x26\x8a\x5b\x3f\xe9\xbc\x1\xef\xe6\x3a\xd3\x4f\x2c\x57\x1c\xda\xb2\xc\x32\x31", 32) == 0;
}
else
printer::inst()->print_msg(L0,
Expand Down
15 changes: 10 additions & 5 deletions xmrstak/backend/cryptonight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ enum xmrstak_algo_id

cryptonight_turtle = start_derived_algo_id,
cryptonight_v8_half = (start_derived_algo_id + 1),
cryptonight_v8_zelerius = (start_derived_algo_id + 2)
cryptonight_v8_zelerius = (start_derived_algo_id + 2),
cryptonight_v8_double = (start_derived_algo_id + 3)
// please add the algorithm name to get_algo_name()
};

Expand Down Expand Up @@ -62,11 +63,12 @@ inline std::string get_algo_name(xmrstak_algo_id algo_id)
"cryptonight_v8_reversewaltz" // used by graft
}};

static std::array<std::string, 3> derived_algo_names =
static std::array<std::string, 4> derived_algo_names =
{{
"cryptonight_turtle",
"cryptonight_v8_half", // used by masari and stellite
"cryptonight_v8_zelerius"
"cryptonight_v8_zelerius",
"cryptonight_v8_double"
}};


Expand Down Expand Up @@ -181,6 +183,8 @@ constexpr uint32_t CN_ZELERIUS_ITER = 0x60000;

constexpr uint32_t CN_WALTZ_ITER = 0x60000;

constexpr uint32_t CN_DOUBLE_ITER = 0x100000;

inline xmrstak_algo POW(xmrstak_algo_id algo_id)
{
static std::array<xmrstak_algo, 18> pow = {{
Expand All @@ -204,11 +208,12 @@ inline xmrstak_algo POW(xmrstak_algo_id algo_id)
{cryptonight_v8_reversewaltz, cryptonight_v8_reversewaltz, CN_WALTZ_ITER, CN_MEMORY}
}};

static std::array<xmrstak_algo, 3> derived_pow =
static std::array<xmrstak_algo, 4> derived_pow =
{{
{cryptonight_turtle, cryptonight_monero_v8, CN_ITER/8, CN_MEMORY/8, CN_TURTLE_MASK},
{cryptonight_v8_half, cryptonight_monero_v8, CN_ITER/2, CN_MEMORY},
{cryptonight_v8_zelerius, cryptonight_monero_v8, CN_ZELERIUS_ITER, CN_MEMORY}
{cryptonight_v8_zelerius, cryptonight_monero_v8, CN_ZELERIUS_ITER, CN_MEMORY},
{cryptonight_v8_double, cryptonight_monero_v8, CN_DOUBLE_ITER, CN_MEMORY}
// {cryptonight_derived}
}};

Expand Down
4 changes: 3 additions & 1 deletion xmrstak/jconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ xmrstak::coin_selection coins[] = {
{ "cryptonight_turtle", {POW(cryptonight_turtle)}, {POW(cryptonight_turtle)}, nullptr },
{ "cryptonight_v7", {POW(cryptonight_monero)}, {POW(cryptonight_gpu)}, nullptr },
{ "cryptonight_v8", {POW(cryptonight_monero_v8)}, {POW(cryptonight_r)}, nullptr },
{ "cryptonight_v8_double", {POW(cryptonight_v8_double)}, {POW(cryptonight_gpu)}, nullptr },
{ "cryptonight_v8_half", {POW(cryptonight_v8_half)}, {POW(cryptonight_gpu)}, nullptr },
{ "cryptonight_v8_reversewaltz", {POW(cryptonight_v8_reversewaltz)}, {POW(cryptonight_gpu)}, nullptr },
{ "cryptonight_v8_zelerius", {POW(cryptonight_v8_zelerius)},{POW(cryptonight_gpu)}, nullptr },
Expand All @@ -120,7 +121,8 @@ xmrstak::coin_selection coins[] = {
{ "stellite", {POW(cryptonight_v8_half)}, {POW(cryptonight_gpu)}, nullptr },
{ "turtlecoin", {POW(cryptonight_turtle), 6u,POW(cryptonight_aeon)}, {POW(cryptonight_aeon)}, nullptr },
{ "plenteum", {POW(cryptonight_turtle)}, {POW(cryptonight_turtle)}, nullptr },
{ "zelerius", {POW(cryptonight_v8_zelerius), 7, POW(cryptonight_monero_v8)}, {POW(cryptonight_gpu)}, nullptr }
{ "zelerius", {POW(cryptonight_v8_zelerius), 7, POW(cryptonight_monero_v8)}, {POW(cryptonight_gpu)}, nullptr },
{ "xcash", {POW(cryptonight_v8_double)}, {POW(cryptonight_gpu)}, nullptr }
};

constexpr size_t coin_algo_size = (sizeof(coins)/sizeof(coins[0]));
Expand Down
2 changes: 2 additions & 0 deletions xmrstak/pools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ POOLCONF],
* ryo
* turtlecoin
* plenteum
* xcash
*
* Native algorithms which do not depend on any block versions:
*
Expand All @@ -47,6 +48,7 @@ POOLCONF],
* cryptonight_superfast
* cryptonight_v7
* cryptonight_v8
* cryptonight_v8_double (used by xcash)
* cryptonight_v8_half (used by masari and stellite)
* cryptonight_v8_reversewaltz (used by graft)
* cryptonight_v8_zelerius
Expand Down

0 comments on commit fdaefd7

Please sign in to comment.