5 inline void extend(uint32_t* exted, uint8_t *g_seed){
6 sha3_ctx *ctx = (sha3_ctx*)calloc(1, sizeof(*ctx));
7 // uint8_t seedHash[4*32];
8 uint8_t seedHash[4][32];
10 // std::copy beats memcpy
11 // std::copy(g_seed, g_seed + 32, seedHash);
12 std::copy(g_seed, g_seed + 32, seedHash[0]);
14 for(int i = 0; i < 3; ++i) {
15 rhash_sha3_256_init(ctx);
16 // rhash_sha3_update(ctx, seedHash+i*32, 32);
17 // rhash_sha3_final(ctx, seedHash+(i+1)*32);
18 rhash_sha3_update(ctx, seedHash[i], 32);
19 rhash_sha3_final(ctx, seedHash[i+1]);
22 for(int i = 0; i < 32; ++i) {
23 // exted[i] = ((*(seedHash+i*4+3))<<24) +
24 // ((*(seedHash+i*4+2))<<16) +
25 // ((*(seedHash+i*4+1))<<8) +
27 exted[i] = (seedHash[i/8][(i*4+3)%32]<<24) +
28 (seedHash[i/8][(i*4+2)%32]<<16) +
29 (seedHash[i/8][(i*4+1)%32]<<8) +
30 seedHash[i/8][(i*4)%32];
36 inline void init_seed(Words32 &seed, uint32_t _seed[32])
38 for (int i = 0; i < 16; i++)
39 seed.lo.w[i] = _seed[i];
40 for (int i = 0; i < 16; i++)
41 seed.hi.w[i] = _seed[16 + i];