Added SHAKE128/256 code and test vectors.

This commit is contained in:
Markku-Juhani O. Saarinen
2015-12-27 13:27:27 +00:00
parent e827929647
commit cc3d33a961
4 changed files with 109 additions and 11 deletions

12
sha3.h
View File

@@ -7,8 +7,8 @@
#include <stddef.h>
#include <stdint.h>
#ifndef SHA3_ROUNDS
#define SHA3_ROUNDS 24
#ifndef KECCAKF_ROUNDS
#define KECCAKF_ROUNDS 24
#endif
#ifndef ROTL64
@@ -32,5 +32,13 @@ int sha3_final(void *md, sha3_ctx_t *c); // digest goes to md
// compute a sha3 hash (md) of given byte length from "in"
void *sha3(const void *in, size_t inlen, void *md, int mdlen);
// SHAKE128 and SHAKE256 extensible-output functions
#define shake128_init(c) sha3_init(c, 16)
#define shake256_init(c) sha3_init(c, 32)
#define shake_update sha3_update
void shake_xof(sha3_ctx_t *c);
void shake_out(sha3_ctx_t *c, void *out, size_t len);
#endif