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"
|
2014-04-19 19:15:36 +02:00
|
|
|
#include "sha256.h"
|
2014-03-30 10:04:48 +02:00
|
|
|
|
2014-04-18 00:39:45 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-04-19 20:27:09 +02:00
|
|
|
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);
|
2014-04-19 21:15:34 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
|