node-multi-hashing/shavite3.c

25 lines
565 B
C
Raw Normal View History

2014-04-19 23:33:45 +02:00
#include "shavite3.h"
2014-05-12 22:12:20 +02:00
#include <string.h>
#include <stdlib.h>
2014-04-19 23:33:45 +02:00
#include "sha3/sph_shavite.h"
void shavite3_hash(const char* input, char* output, uint32_t len)
{
char hash1[64];
char hash2[64];
2014-04-19 23:33:45 +02:00
sph_shavite512_context ctx_shavite;
sph_shavite512_init(&ctx_shavite);
sph_shavite512(&ctx_shavite, (const void*) input, len);
sph_shavite512_close(&ctx_shavite, (void*) &hash1);
2014-04-19 23:33:45 +02:00
sph_shavite512(&ctx_shavite, (const void*) &hash1, 64);
sph_shavite512_close(&ctx_shavite, (void*) &hash2);
2014-04-19 23:33:45 +02:00
memcpy(output, &hash2, 32);
2014-04-19 23:33:45 +02:00
}