danicoin/src/crypto/hash.c

25 lines
682 B
C
Raw Normal View History

// Copyright (c) 2011-2016 The Cryptonote developers
2014-03-03 22:07:58 +00:00
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2013-11-14 22:28:17 +00:00
#include <stddef.h>
#include <stdint.h>
#include <string.h>
2014-03-03 22:07:58 +00:00
#include "hash-ops.h"
#include "keccak.h"
2013-11-14 22:28:17 +00:00
2014-03-03 22:07:58 +00:00
void hash_permutation(union hash_state *state) {
keccakf((uint64_t*)state, 24);
2013-11-14 22:28:17 +00:00
}
2014-03-03 22:07:58 +00:00
void hash_process(union hash_state *state, const uint8_t *buf, size_t count) {
2015-05-27 12:08:46 +00:00
keccak1600(buf, (int)count, (uint8_t*)state);
2013-11-14 22:28:17 +00:00
}
2014-03-03 22:07:58 +00:00
void cn_fast_hash(const void *data, size_t length, char *hash) {
union hash_state state;
hash_process(&state, data, length);
memcpy(hash, &state, HASH_SIZE);
}