node-multi-hashing/skein.c

29 lines
639 B
C
Raw Normal View History

2014-03-30 10:04:48 +02:00
#include "skein.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "sha3/sph_skein.h"
#include "sha256.h"
2014-03-30 10:04:48 +02:00
2014-04-18 00:39:45 +02:00
#include <stdlib.h>
void skein_hash(const char* input, char* output, uint32_t len)
2014-03-30 10:04:48 +02:00
{
2014-04-18 00:39:45 +02:00
char* temp = (char*) malloc(64);
sph_skein512_context ctx_skien;
sph_skein512_init(&ctx_skien);
sph_skein512(&ctx_skien, input, len);
sph_skein512_close(&ctx_skien, temp);
SHA256_CTX ctx_sha256;
SHA256_Init(&ctx_sha256);
SHA256_Update(&ctx_sha256, temp, 64);
SHA256_Final((unsigned char*) output, &ctx_sha256);
2014-04-18 00:39:45 +02:00
free(temp);
2014-03-30 10:04:48 +02:00
}