forked from zone117x/node-multi-hashing
-
Notifications
You must be signed in to change notification settings - Fork 2
/
skunk.c
41 lines (30 loc) · 914 Bytes
/
skunk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "skunk.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "sha3/sph_skein.h"
#include "sha3/sph_cubehash.h"
#include "sha3/sph_fugue.h"
#include "sha3/sph_gost.h"
void skunk_hash(const char* input, char* output, uint32_t len)
{
sph_skein512_context ctx_skein;
sph_cubehash512_context ctx_cube;
sph_fugue512_context ctx_fugue;
sph_gost512_context ctx_gost;
uint32_t hash[16];
sph_skein512_init(&ctx_skein);
sph_skein512(&ctx_skein, input, len);
sph_skein512_close(&ctx_skein, hash);
sph_cubehash512_init(&ctx_cube);
sph_cubehash512(&ctx_cube, hash, 64);
sph_cubehash512_close(&ctx_cube, 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, hash, 64);
sph_gost512_close(&ctx_gost, hash);
memcpy(output, hash, 32);
}