Add Mike Algorithm

* Mike algorithm is a variant of the ghostrider algorithm
This commit is contained in:
michael-EA 2022-09-27 10:10:27 +01:00
parent 834ea44507
commit 4447c81afe
8 changed files with 82 additions and 19 deletions

View file

@ -539,7 +539,7 @@ void destroy_helper_thread(HelperThread* t)
delete t;
}
template <size_t CORE_ALGO_LIMIT>
void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ctx** ctx, HelperThread* helper, bool verbose)
{
enum { N = 8 };
@ -550,7 +550,7 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
}
// PrevBlockHash (GhostRider's seed) is stored in bytes [4; 36)
uint32_t core_indices[15];
uint32_t core_indices[CORE_ALGO_LIMIT];
select_indices(core_indices, data + 4);
uint32_t cn_indices[6];
@ -601,6 +601,9 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
for (size_t i = 0; i < 5; ++i) {
for (size_t j = n; j < N; ++j) {
if ((part * 5 + i) >= CORE_ALGO_LIMIT) {
break;
}
core_hash[core_indices[part * 5 + i]](input + j * input_size, input_size, tmp + j * 64);
}
input = tmp;
@ -645,6 +648,9 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
for (size_t i = 0; i < 5; ++i) {
for (size_t j = 0; j < n; ++j) {
if ((part * 5 + i) >= CORE_ALGO_LIMIT) {
break;
}
core_hash[core_indices[part * 5 + i]](input + j * input_size, input_size, tmp + j * 64);
}
input = tmp;
@ -713,6 +719,9 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
for (size_t i = 0; i < 5; ++i) {
for (size_t j = n; j < N; ++j) {
if ((part * 5 + i) >= CORE_ALGO_LIMIT) {
break;
}
core_hash[core_indices[part * 5 + i]](input + j * input_size, input_size, tmp + j * 64);
}
input = tmp;
@ -733,6 +742,9 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
for (size_t i = 0; i < 5; ++i) {
for (size_t j = 0; j < n; ++j) {
if ((part * 5 + i) >= CORE_ALGO_LIMIT) {
break;
}
core_hash[core_indices[part * 5 + i]](data + j * size, size, tmp + j * 64);
}
data = tmp;
@ -769,6 +781,7 @@ HelperThread* create_helper_thread(int64_t, int, const std::vector<int64_t>&) {
void destroy_helper_thread(HelperThread*) {}
template <size_t CORE_ALGO_LIMIT>
void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ctx** ctx, HelperThread*, bool verbose)
{
constexpr uint32_t N = 8;
@ -829,6 +842,9 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
for (size_t i = 0; i < 5; ++i) {
for (size_t j = 0; j < N; ++j) {
if ((part * 5 + i) >= CORE_ALGO_LIMIT) {
break;
}
core_hash[core_indices[part * 5 + i]](data + j * size, size, tmp + j * 64);
}
data = tmp;