From 6502e4ea0bb95d597ef4a1119f299dbad7cdc141 Mon Sep 17 00:00:00 2001 From: Christoph Beyer Date: Fri, 12 Jan 2018 00:54:57 +0100 Subject: [PATCH 1/5] test commit --- cpu-miner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu-miner.c b/cpu-miner.c index 1652a281f..70aa50d0d 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -197,7 +197,7 @@ struct option { static char const usage[] = "\ -Usage: " PROGRAM_NAME " [OPTIONS]\n\ +Usage example: " PROGRAM_NAME " [OPTIONS]\n\ Options:\n\ -a, --algo=ALGO specify the algorithm to use\n\ scrypt scrypt(1024, 1, 1) (default)\n\ From 0f83aabc3dacd9ceb26ff53b844f5efbbd9ad017 Mon Sep 17 00:00:00 2001 From: Christoph Beyer Date: Mon, 15 Jan 2018 23:51:58 +0100 Subject: [PATCH 2/5] duplicate commands inline --- cryptonight.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cryptonight.c b/cryptonight.c index 43bcef7df..816dce838 100644 --- a/cryptonight.c +++ b/cryptonight.c @@ -112,6 +112,7 @@ struct cryptonight_ctx { oaes_ctx* aes_ctx; }; +// https://cryptonote.org/cns/cns008.txt ? void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cryptonight_ctx* ctx) { hash_process(&ctx->state.hs, (const uint8_t*) input, len); ctx->aes_ctx = (oaes_ctx*) oaes_alloc(); @@ -134,7 +135,7 @@ void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cr xor_blocks_dst(&ctx->state.k[0], &ctx->state.k[32], ctx->a); xor_blocks_dst(&ctx->state.k[16], &ctx->state.k[48], ctx->b); - for (i = 0; likely(i < ITER / 4); ++i) { + for (i = 0; likely(i < ITER / 8); ++i) { /* Dependency chain: address -> read value ------+ * written value <-+ hard function (AES or MUL) <+ * next address <-+ @@ -151,6 +152,24 @@ void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cr xor_blocks_dst(ctx->b, ctx->c, &ctx->long_state[j]); /* Iteration 4 */ mul_sum_xor_dst(ctx->b, ctx->a, &ctx->long_state[e2i(ctx->b)]); + + /* Dependency chain: address -> read value ------+ + * written value <-+ hard function (AES or MUL) <+ + * next address <-+ + */ + /* Iteration 1 */ + j = e2i(ctx->a); + aesb_single_round(&ctx->long_state[j], ctx->c, ctx->a); + xor_blocks_dst(ctx->c, ctx->b, &ctx->long_state[j]); + /* Iteration 2 */ + mul_sum_xor_dst(ctx->c, ctx->a, &ctx->long_state[e2i(ctx->c)]); + /* Iteration 3 */ + j = e2i(ctx->a); + aesb_single_round(&ctx->long_state[j], ctx->b, ctx->a); + xor_blocks_dst(ctx->b, ctx->c, &ctx->long_state[j]); + /* Iteration 4 */ + mul_sum_xor_dst(ctx->b, ctx->a, &ctx->long_state[e2i(ctx->b)]); + } memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE); From 4730b0a4e873b821730a129127959ba47b1b1623 Mon Sep 17 00:00:00 2001 From: Christoph Beyer Date: Tue, 16 Jan 2018 22:19:35 +0100 Subject: [PATCH 3/5] add info message --- cryptonight.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cryptonight.c b/cryptonight.c index 816dce838..e010f8a59 100644 --- a/cryptonight.c +++ b/cryptonight.c @@ -135,6 +135,8 @@ void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cr xor_blocks_dst(&ctx->state.k[0], &ctx->state.k[32], ctx->a); xor_blocks_dst(&ctx->state.k[16], &ctx->state.k[48], ctx->b); + print("Before ITER\n"); + for (i = 0; likely(i < ITER / 8); ++i) { /* Dependency chain: address -> read value ------+ * written value <-+ hard function (AES or MUL) <+ @@ -172,6 +174,8 @@ void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cr } + print("After ITER\n"); + memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE); oaes_key_import_data(ctx->aes_ctx, &ctx->state.hs.b[32], AES_KEY_SIZE); for (i = 0; likely(i < MEMORY); i += INIT_SIZE_BYTE) { From 1153a7286c8804fd8a65e39473dc6d96dff97f8c Mon Sep 17 00:00:00 2001 From: Christoph Beyer Date: Tue, 16 Jan 2018 22:34:10 +0100 Subject: [PATCH 4/5] print --- cryptonight.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cryptonight.c b/cryptonight.c index e010f8a59..8df77b199 100644 --- a/cryptonight.c +++ b/cryptonight.c @@ -4,6 +4,7 @@ // Modified for CPUminer by Lucas Jones +#include #include "cpuminer-config.h" #include "miner.h" #include "crypto/oaes_lib.h" @@ -135,7 +136,7 @@ void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cr xor_blocks_dst(&ctx->state.k[0], &ctx->state.k[32], ctx->a); xor_blocks_dst(&ctx->state.k[16], &ctx->state.k[48], ctx->b); - print("Before ITER\n"); + printf("Before ITER\n"); for (i = 0; likely(i < ITER / 8); ++i) { /* Dependency chain: address -> read value ------+ From ddcacab20e14423849c3e4d972c46067626bb3eb Mon Sep 17 00:00:00 2001 From: Christoph Beyer Date: Tue, 16 Jan 2018 22:43:53 +0100 Subject: [PATCH 5/5] ... --- cryptonight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptonight.c b/cryptonight.c index 8df77b199..b994214b0 100644 --- a/cryptonight.c +++ b/cryptonight.c @@ -175,7 +175,7 @@ void cryptonight_hash_ctx(void* output, const void* input, size_t len, struct cr } - print("After ITER\n"); + printf("After ITER\n"); memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE); oaes_key_import_data(ctx->aes_ctx, &ctx->state.hs.b[32], AES_KEY_SIZE);