From 4cf87e91d8ccdcca209034e59a32765a310f7551 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 27 Jul 2015 17:27:54 +0200 Subject: [PATCH] axiom: remove useless loop --- algo/axiom.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/algo/axiom.c b/algo/axiom.c index d79edb9..b13e431 100644 --- a/algo/axiom.c +++ b/algo/axiom.c @@ -10,7 +10,7 @@ static __thread uint32_t _ALIGN(128) M[65536][8]; void axiomhash(void *output, const void *input) { sph_shabal256_context ctx; - const int R = 2, N = 65536; + const int N = 65536; sph_shabal256_init(&ctx); sph_shabal256(&ctx, input, 80); @@ -22,21 +22,24 @@ void axiomhash(void *output, const void *input) sph_shabal256_close(&ctx, M[i]); } - for(int r = 1; r < R; r++) + for(int b = 0; b < N; b++) { - for(int b = 0; b < N; b++) - { - const int p = b > 0 ? b - 1 : 0xFFFF; - const int q = M[p][0] % 0xFFFF; - const int j = (b + q) % N; - - //sph_shabal256_init(&ctx); - sph_shabal256(&ctx, M[p], 32); - sph_shabal256(&ctx, M[j], 32); - sph_shabal256_close(&ctx, M[b]); - } - } + const int p = b > 0 ? b - 1 : 0xFFFF; + const int q = M[p][0] % 0xFFFF; + const int j = (b + q) % N; + //sph_shabal256_init(&ctx); +#if 0 + sph_shabal256(&ctx, M[p], 32); + sph_shabal256(&ctx, M[j], 32); +#else + uint8_t _ALIGN(128) hash[64]; + memcpy(hash, M[p], 32); + memcpy(&hash[32], M[j], 32); + sph_shabal256(&ctx, hash, 64); +#endif + sph_shabal256_close(&ctx, M[b]); + } memcpy(output, M[N-1], 32); } -- 2.42.0