Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdint.h>
- #include <string.h>
- #include <stdio.h>
- #include "sha3/sph_shabal.h"
- //#define DEBUG_ALGO
- void axiomhash(void *output, const void *input)
- {
- sph_shabal256_context ctx_shabal;
- static unsigned char pblank[1];
- pblank[0] = 0;
- // uint32_t hash[32];
- uint32_t hash;
- sph_shabal256_init(&ctx_shabal);
- sph_shabal256 (&ctx_shabal, input, 80);
- sph_shabal256_close(&ctx_shabal, (&hash));
- int R = 2;
- int N = 65536;
- // std::vector<uint256> M(N);
- uint32_t M[524288] = { 0 };
- for(int i = 1; i < N; i++)
- {
- //HashShabal((unsigned char*)&M[i - 1], sizeof(M[i - 1]), (unsigned char*)&M[i]);
- sph_shabal256_init(&ctx_shabal);
- sph_shabal256 (&ctx_shabal, (unsigned char*)&M[i - 1], sizeof(M[i - 1]));
- sph_shabal256_close(&ctx_shabal, (unsigned char*)&M[i]);
- }
- for(int r = 1; r < R; r ++)
- {
- for(int b = 0; b < N; b++)
- {
- int p = (b - 1 + N) % N;
- // int q = M[p].GetInt() % (N - 1);
- int q = M[p] % (N - 1);
- int j = (b + q) % N;
- // std::vector<uint256> pj(2);
- uint32_t pj[2] = { 0 };
- pj[0] = M[p];
- pj[1] = M[j];
- //HashShabal((unsigned char*)&pj[0], 2 * sizeof(pj[0]), (unsigned char*)&M[b]);
- sph_shabal256_init(&ctx_shabal);
- sph_shabal256 (&ctx_shabal, (unsigned char*)&pj[0], 2 * sizeof(pj[0]));
- sph_shabal256_close(&ctx_shabal, (unsigned char*)&M[b]);
- }
- }
- hash = M[N - 1];
- memcpy(output, hash, 32);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement