2021-04-22 01:34:51 +03:00
|
|
|
// Copyright (c) 2020-2021 Zano project
|
2018-12-27 18:50:45 +03:00
|
|
|
// Copyright (c) 2012-2013 The Cryptonote developers
|
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "hash-ops.h"
|
|
|
|
|
#include "keccak.h"
|
|
|
|
|
|
|
|
|
|
void hash_permutation(union hash_state *state) {
|
|
|
|
|
keccakf((uint64_t*)state, 24);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void hash_process(union hash_state *state, const uint8_t *buf, size_t count) {
|
|
|
|
|
keccak1600(buf, (int)count, (uint8_t*)state);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-22 01:34:51 +03:00
|
|
|
void cn_fast_hash_old(const void *data, size_t length, char *hash)
|
|
|
|
|
{
|
2018-12-27 18:50:45 +03:00
|
|
|
union hash_state state;
|
|
|
|
|
hash_process(&state, data, length);
|
|
|
|
|
memcpy(hash, &state, HASH_SIZE);
|
|
|
|
|
}
|
2021-04-22 01:34:51 +03:00
|
|
|
|
|
|
|
|
void cn_fast_hash(const void *data, size_t length, char *hash)
|
|
|
|
|
{
|
2021-04-27 05:14:11 +03:00
|
|
|
keccak(data, (int)length, (uint8_t*)hash, HASH_SIZE);
|
2021-04-22 01:34:51 +03:00
|
|
|
}
|