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

@ -452,6 +452,28 @@ const static uint8_t test_output_gr[256] = {
0xC4, 0xA7, 0xC7, 0x77, 0xAD, 0xF8, 0x09, 0x61, 0x16, 0xBB, 0xAA, 0x7E, 0xAB, 0xC3, 0x00, 0x25,
0xBA, 0xA8, 0x97, 0xC7, 0x7D, 0x38, 0x46, 0x0E, 0x59, 0xAC, 0xCB, 0xAE, 0xFE, 0x3C, 0x6F, 0x01
};
// "GhostRider/Mike"
const static uint8_t test_output_gr_mike[256] = {
0x4a, 0xad, 0xfc, 0x1b, 0xad, 0x21, 0x65, 0xa7, 0x69, 0x6f, 0x87, 0x3e, 0x5d, 0xb7, 0x3c, 0x20,
0x5f, 0x3a, 0x4b, 0x87, 0xa3, 0x4b, 0x54, 0x35, 0x70, 0xca, 0xfc, 0x95, 0x48, 0xab, 0x5b,
0x74, 0xfc, 0x9c, 0xb, 0xd8, 0xe5, 0x98, 0x1, 0xf1, 0x9f, 0x9e, 0x7f, 0xd4, 0xe4, 0xaf,
0x7d, 0x14, 0x7d, 0xde, 0x8e, 0x8a, 0xdf, 0xe6, 0x4a, 0x30, 0x9a, 0x92, 0xf5, 0x12, 0x3f,
0x16, 0xf3, 0xf0, 0xc7, 0x2f, 0xf7, 0x4b, 0x6, 0x82, 0xa5, 0x50, 0xa0, 0xb3, 0xb8, 0x81,
0xa, 0xde, 0x29, 0x4e, 0xcd, 0x72, 0x57, 0x60, 0x4e, 0xc1, 0x23, 0x46, 0x1b, 0x39, 0x23,
0xcc, 0x4a, 0x64, 0x7b, 0x2d, 0x8b, 0x4, 0xa1, 0xea, 0xa4, 0xa0, 0xf9, 0x3d, 0x7d, 0x26,
0x22, 0xf0, 0xa6, 0xa, 0x18, 0x2c, 0xd5, 0x88, 0x4f, 0x47, 0xb7, 0x72, 0x83, 0xa9, 0xcd,
0x17, 0x24, 0xb, 0x39, 0x3c, 0x54, 0x51, 0x47, 0xef, 0x77, 0x55, 0xa, 0x9b, 0x56, 0x6,
0x47, 0xbe, 0xdb, 0x85, 0x78, 0x3a, 0x15, 0x31, 0x8c, 0x60, 0xce, 0xe9, 0x9a, 0x1f, 0xdd,
0x8c, 0xcc, 0xf0, 0x17, 0xa5, 0x99, 0x17, 0xb5, 0x5d, 0x30, 0xae, 0x8d, 0x7a, 0xd2, 0xfd,
0xd5, 0x66, 0xdd, 0x23, 0xa0, 0xca, 0x56, 0x66, 0x64, 0x6c, 0x38, 0xda, 0xdf, 0x91, 0x12,
0x6, 0x9a, 0x11, 0x13, 0x4e, 0xcf, 0x71, 0xf4, 0xb, 0x26, 0x50, 0x7d, 0x0, 0x6f, 0xc4,
0x39, 0xb5, 0xd, 0xaa, 0xa3, 0x60, 0x5e, 0x41, 0x82, 0xe0, 0xce, 0x38, 0x7f, 0x37, 0x90,
0xac, 0x53, 0xbe, 0x46, 0xb4, 0x6a, 0xc4, 0xb8, 0xe1, 0x9f, 0x31, 0x9f, 0xf4, 0xff, 0x46,
0x73, 0x92, 0xee, 0x64, 0xa6, 0x44, 0xac, 0xd4, 0x33, 0xb8, 0x3b, 0x84, 0x42, 0x7e, 0x9a,
0x80, 0xf0, 0xa8, 0x71, 0xf0, 0x81, 0xc4, 0xc1, 0x52, 0xff, 0x27, 0x4e, 0x7, 0xf0, 0x70
};
#endif

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;

View file

@ -41,6 +41,8 @@ struct HelperThread;
void benchmark();
HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::vector<int64_t>& affinities);
void destroy_helper_thread(HelperThread* 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 = true);