mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27:25 +00:00
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include <sha3/sph_skein.h>
|
|
#include <sha3/sph_shabal.h>
|
|
#include <sha3/sph_echo.h>
|
|
#include <sha3/sph_luffa.h>
|
|
#include <sha3/sph_fugue.h>
|
|
#include "gost.h"
|
|
|
|
#include "common.h"
|
|
|
|
void polytimos_hash(const char *input, char* output, uint32_t len)
|
|
{
|
|
uint32_t _ALIGN(64) hash[16];
|
|
|
|
sph_skein512_context ctx_skein;
|
|
sph_shabal512_context ctx_shabal;
|
|
sph_echo512_context ctx_echo;
|
|
sph_luffa512_context ctx_luffa;
|
|
sph_fugue512_context ctx_fugue;
|
|
sph_gost512_context ctx_gost;
|
|
|
|
sph_skein512_init(&ctx_skein);
|
|
sph_skein512(&ctx_skein, input, 80);
|
|
sph_skein512_close(&ctx_skein, (void*) hash);
|
|
|
|
sph_shabal512_init(&ctx_shabal);
|
|
sph_shabal512(&ctx_shabal, hash, 64);
|
|
sph_shabal512_close(&ctx_shabal, hash);
|
|
|
|
sph_echo512_init(&ctx_echo);
|
|
sph_echo512(&ctx_echo, hash, 64);
|
|
sph_echo512_close(&ctx_echo, hash);
|
|
|
|
sph_luffa512_init(&ctx_luffa);
|
|
sph_luffa512(&ctx_luffa, hash, 64);
|
|
sph_luffa512_close(&ctx_luffa, hash);
|
|
|
|
sph_fugue512_init(&ctx_fugue);
|
|
sph_fugue512(&ctx_fugue, hash, 64);
|
|
sph_fugue512_close(&ctx_fugue, hash);
|
|
|
|
sph_gost512_init(&ctx_gost);
|
|
sph_gost512(&ctx_gost, (const void*) hash, 64);
|
|
sph_gost512_close(&ctx_gost, (void*) hash);
|
|
|
|
memcpy(output, hash, 32);
|
|
}
|
|
|