Commit 1c8cc9e9 authored by Niels Möller's avatar Niels Möller
Browse files

Implemented sha3.

parent c835888e
2012-11-12 Niels Möller <nisse@lysator.liu.se>
* sha3-permute.c: New file. Permutation function for sha3, aka
Keccak.
* sha3.h: New header file.
* sha3.c: New file, absorption and padding for sha3.
* sha3-256.c: New file.
* sha3-256-meta.c: New file.
* nettle-meta.h (nettle_sha3_256): Declare.
* Makefile.in (nettle_SOURCES): Added sha3 files.
(HEADERS): Added sha3.h.
* testsuite/sha3.awk: New file. Script to extract test vectors.
* testsuite/sha3-256-test.c: New file.
* testsuite/sha3-permute-test.c: New file.
* testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
sha3-permute-test.c and sha3-256-test.c.
(DISTFILES): Added sha3.awk.
* testsuite/.test-rules.make: Added sha3 targets.
* macros.h (LE_WRITE_UINT64): New macro.
* write-le64.c (_nettle_write_le64): New file and function.
* nettle-write.h (_nettle_write_le64): Declare. Also deleted
......
......@@ -88,6 +88,7 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
sha1.c sha1-compress.c sha1-meta.c \
sha256.c sha256-compress.c sha224-meta.c sha256-meta.c \
sha512.c sha512-compress.c sha384-meta.c sha512-meta.c \
sha3.c sha3-permute.c sha3-256.c sha3-256-meta.c \
serpent-set-key.c serpent-encrypt.c serpent-decrypt.c \
serpent-meta.c \
twofish.c twofish-meta.c \
......@@ -136,7 +137,7 @@ HEADERS = aes.h arcfour.h arctwo.h asn1.h bignum.h blowfish.h \
nettle-meta.h nettle-types.h \
pgp.h pkcs1.h realloc.h ripemd160.h rsa.h rsa-compat.h \
salsa20.h sexp.h \
serpent.h sha.h twofish.h \
serpent.h sha.h sha3.h twofish.h \
yarrow.h
INSTALL_HEADERS = $(HEADERS) nettle-stdint.h
......
......@@ -165,6 +165,7 @@ extern const struct nettle_hash nettle_sha224;
extern const struct nettle_hash nettle_sha256;
extern const struct nettle_hash nettle_sha384;
extern const struct nettle_hash nettle_sha512;
extern const struct nettle_hash nettle_sha3_256;
struct nettle_armor
{
......
/* sha3-256-meta.c */
/* nettle, low-level cryptographics library
*
* Copyright (C) 2012 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "nettle-meta.h"
#include "sha3.h"
const struct nettle_hash nettle_sha3_256
= _NETTLE_HASH(sha3_256, SHA3_256);
/* sha3-256.c
*
* The sha3 hash function, 256 bit output.
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2012 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <stddef.h>
#include <string.h>
#include "sha3.h"
#include "nettle-write.h"
void
sha3_256_init (struct sha3_256_ctx *ctx)
{
memset (&ctx->state, 0, offsetof (struct sha3_256_ctx, block));
}
void
sha3_256_update (struct sha3_256_ctx *ctx,
unsigned length,
const uint8_t *data)
{
ctx->index = _sha3_update (&ctx->state, SHA3_256_DATA_SIZE, ctx->block,
ctx->index, length, data);
}
void
sha3_256_digest(struct sha3_256_ctx *ctx,
unsigned length,
uint8_t *digest)
{
_sha3_pad (&ctx->state, SHA3_256_DATA_SIZE, ctx->block, ctx->index);
_nettle_write_le64 (length, digest, ctx->state.a);
sha3_256_init (ctx);
}
/* sha3-permute.c
*
* The sha3 permutation function (aka Keccak).
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2012 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "sha3.h"
#include "macros.h"
#define SHA3_ROUNDS 24
/* Based on the pseudocode description at
http://keccak.noekeon.org/specs_summary.html */
void
sha3_permute (struct sha3_state *state)
{
static const unsigned char rot[25] =
{
0, 1, 62, 28, 27,
36, 44, 6, 55, 20,
3, 10, 43, 25, 39,
41, 45, 15, 21, 8,
18, 2, 61, 56, 14,
};
static const uint64_t rc[SHA3_ROUNDS] = {
0x0000000000000001, 0x0000000000008082,
0x800000000000808A, 0x8000000080008000,
0x000000000000808B, 0x0000000080000001,
0x8000000080008081, 0x8000000000008009,
0x000000000000008A, 0x0000000000000088,
0x0000000080008009, 0x000000008000000A,
0x000000008000808B, 0x800000000000008B,
0x8000000000008089, 0x8000000000008003,
0x8000000000008002, 0x8000000000000080,
0x000000000000800A, 0x800000008000000A,
0x8000000080008081, 0x8000000000008080,
0x0000000080000001, 0x8000000080008008,
};
unsigned i;
for (i = 0; i < SHA3_ROUNDS; i++)
{
uint64_t C[5], D[5], B[25];
unsigned x, y;
/* theta step */
for (x = 0; x < 5; x++)
C[x] = state->a[x] ^ state->a[5+x] ^ state->a[10+x]
^ state->a[15+x] ^ state->a[20+x];
for (x = 0; x < 5; x++)
/* Use the simplest indexing expressions in the argument to
the ROTL64 macro */
D[(x+4)%5] = C[(x+3)%5] ^ ROTL64(1, C[x]);
for (x = 0; x < 5; x++)
for (y = 0; y < 5; y++)
state->a[x +5*y] ^= D[x];
/* rho step */
for (x = 0; x < 25; x++)
state->a[x] = ROTL64 (rot[x], state->a[x]);
/* pi step */
for (x = 0; x < 5; x++)
for (y = 0; y < 5; y++)
/* B[y,2*x+3*y] = B[y+5*(2*x + 3*y)]= B[10*x + 16*y] */
B[(10*x+16*y) % 25] = state->a[x+5*y];
/* chi step */
for (x = 0; x < 5; x++)
for (y = 0; y < 5; y++)
state->a[x+5*y] = B[x+5*y] ^ (~B[(x+1)%5 + 5*y] & B[(x+2)%5+5*y]);
/* iota step */
state->a[0] ^= rc[i];
}
}
/* sha3.c
*
* The sha3 hash function.
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2012 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <string.h>
#include "sha3.h"
#include "memxor.h"
static void
sha3_absorb (struct sha3_state *state, unsigned length, const uint8_t *data)
{
assert ( (length & 7) == 0);
#if WORDS_BIGENDIAN
{
uint64_t *p;
for (p = &state->a[0][0]; length > 0; p++, length -= 8, data += 8)
*p ^= LE_READ_UINT64 (data);
}
#else /* !WORDS_BIGENDIAN */
memxor ((uint8_t *) state->a, data, length);
#endif
sha3_permute (state);
}
unsigned
_sha3_update (struct sha3_state *state,
unsigned block_size, uint8_t *block,
unsigned pos,
unsigned length, const uint8_t *data)
{
if (pos > 0)
{
unsigned left = block_size - pos;
if (length < pos)
{
memcpy (block + pos, data, length);
return pos + length;
}
else
{
memcpy (block + pos, data, left);
data += left;
length -= left;
sha3_absorb (state, block_size, block);
}
}
for (; length >= block_size; length -= block_size, data += block_size)
sha3_absorb (state, block_size, data);
memcpy (block, data, length);
return length;
}
void
_sha3_pad (struct sha3_state *state,
unsigned block_size, uint8_t *block, unsigned pos)
{
assert (pos < block_size);
block[pos++] = 1;
memset (block + pos, 0, block_size - pos);
block[block_size - 1] |= 0x80;
sha3_absorb (state, block_size, block);
}
/* sha3.h
*
* The sha3 hash function (aka Keccak).
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2012 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#ifndef NETTLE_SHA3_H_INCLUDED
#define NETTLE_SHA3_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define sha3_permute nettle_sha3_permute
#define _sha3_update _nettle_sha3_update
#define _sha3_pad _nettle_sha3_pad
#define sha3_256_init nettle_sha3_256_init
#define sha3_256_update nettle_sha3_256_update
#define sha3_256_digest nettle_sha3_256_digest
/* The sha3 state is a 5x5 matrix of 64-bit words. In the notation of
Keccak description, S[x,y] is element x + 5*y, so if x is
interpreted as the row index and y the column index, it is stored
in column-major order. */
#define SHA3_STATE_LENGTH 25
/* The "width" is 1600 bits or 200 octets */
struct sha3_state
{
uint64_t a[SHA3_STATE_LENGTH];
};
void
sha3_permute (struct sha3_state *state);
unsigned
_sha3_update (struct sha3_state *state,
unsigned block_size, uint8_t *block,
unsigned pos,
unsigned length, const uint8_t *data);
void
_sha3_pad (struct sha3_state *state,
unsigned block_size, uint8_t *block, unsigned pos);
/* The "capacity" is set to 2*(digest size), 512 bits or 64 octets.
The "rate" is the width - capacity, or width - 2 * (digest
size). */
#define SHA3_224_DIGEST_SIZE 28
#define SHA3_224_DATA_SIZE 144
#define SHA3_256_DIGEST_SIZE 32
#define SHA3_256_DATA_SIZE 136
#define SHA3_384_DIGEST_SIZE 48
#define SHA3_384_DATA_SIZE 104
#define SHA3_512_DIGEST_SIZE 64
#define SHA3_512_DATA_SIZE 72
struct sha3_224_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_224_DATA_SIZE];
};
struct sha3_256_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_256_DATA_SIZE];
};
void
sha3_256_init (struct sha3_256_ctx *ctx);
void
sha3_256_update (struct sha3_256_ctx *ctx,
unsigned length,
const uint8_t *data);
void
sha3_256_digest(struct sha3_256_ctx *ctx,
unsigned length,
uint8_t *digest);
struct sha3_384_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_384_DATA_SIZE];
};
struct sha3_512_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_512_DATA_SIZE];
};
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SHA3_H_INCLUDED */
......@@ -70,6 +70,12 @@ sha384-test$(EXEEXT): sha384-test.$(OBJEXT)
sha512-test$(EXEEXT): sha512-test.$(OBJEXT)
$(LINK) sha512-test.$(OBJEXT) $(TEST_OBJS) -o sha512-test$(EXEEXT)
sha3-permute-test$(EXEEXT): sha3-permute-test.$(OBJEXT)
$(LINK) sha3-permute-test.$(OBJEXT) $(TEST_OBJS) -o sha3-permute-test$(EXEEXT)
sha3-256-test$(EXEEXT): sha3-256-test.$(OBJEXT)
$(LINK) sha3-256-test.$(OBJEXT) $(TEST_OBJS) -o sha3-256-test$(EXEEXT)
serpent-test$(EXEEXT): serpent-test.$(OBJEXT)
$(LINK) serpent-test.$(OBJEXT) $(TEST_OBJS) -o serpent-test$(EXEEXT)
......
......@@ -21,6 +21,7 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
salsa20-test.c \
sha1-test.c sha224-test.c sha256-test.c \
sha384-test.c sha512-test.c \
sha3-permute-test.c sha3-256-test.c \
serpent-test.c twofish-test.c \
knuth-lfib-test.c \
cbc-test.c ctr-test.c gcm-test.c hmac-test.c \
......@@ -52,7 +53,7 @@ SOURCES = $(TS_SOURCES) $(EXTRA_SOURCES) testutils.c
DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
$(TS_SH) setup-env teardown-env \
gold-bug.txt testutils.h
gold-bug.txt testutils.h sha3.awk
all: $(TARGETS) $(EXTRA_TARGETS)
......
#include "testutils.h"
void
test_main(void)
{
/* Extracted from ShortMsgKAT_256.txt using sha3.awk. */
test_hash(&nettle_sha3_256, /* 0 octets */
SHEX(""),
SHEX("C5D2460186F7233C927E7DB2DCC703C0E500B653CA82273B7BFAD8045D85A470"));
test_hash(&nettle_sha3_256, /* 1 octets */
SHEX("CC"),
SHEX("EEAD6DBFC7340A56CAEDC044696A168870549A6A7F6F56961E84A54BD9970B8A"));
test_hash(&nettle_sha3_256, /* 2 octets */
SHEX("41FB"),
SHEX("A8EACEDA4D47B3281A795AD9E1EA2122B407BAF9AABCB9E18B5717B7873537D2"));
test_hash(&nettle_sha3_256, /* 3 octets */
SHEX("1F877C"),
SHEX("627D7BC1491B2AB127282827B8DE2D276B13D7D70FB4C5957FDF20655BC7AC30"));
test_hash(&nettle_sha3_256, /* 4 octets */
SHEX("C1ECFDFC"),
SHEX("B149E766D7612EAF7D55F74E1A4FDD63709A8115B14F61FCD22AA4ABC8B8E122"));
test_hash(&nettle_sha3_256, /* 5 octets */
SHEX("21F134AC57"),
SHEX("67F05544DBE97D5D6417C1B1EA9BC0E3A99A541381D1CD9B08A9765687EB5BB4"));
test_hash(&nettle_sha3_256, /* 6 octets */
SHEX("C6F50BB74E29"),
SHEX("923062C4E6F057597220D182DBB10E81CD25F60B54005B2A75DD33D6DAC518D0"));
test_hash(&nettle_sha3_256, /* 7 octets */
SHEX("119713CC83EEEF"),
SHEX("FEB8405DCD315D48C6CBF7A3504996DE8E25CC22566EFEC67433712EDA99894F"));
test_hash(&nettle_sha3_256, /* 8 octets */
SHEX("4A4F202484512526"),
SHEX("E620D8F2982B24FEDAAA3BAA9B46C3F9CE204EE356666553ECB35E15C3FF9BF9"));
test_hash(&nettle_sha3_256, /* 9 octets */
SHEX("1F66AB4185ED9B6375"),
SHEX("9E03F7C9A3D055ECA1D786ED6FB624D93F1CF0AC27F9C2B6C05E509FAC9E7FCA"));
test_hash(&nettle_sha3_256, /* 10 octets */
SHEX("EED7422227613B6F53C9"),
SHEX("CAAD8E1ED546630748A12F5351B518A9A431CDA6BA56CBFC3CCBDD8AAE5092F7"));
test_hash(&nettle_sha3_256, /* 11 octets */
SHEX("EAEED5CDFFD89DECE455F1"),
SHEX("D61708BDB3211A9AAB28D4DF01DFA4B29ED40285844D841042257E97488617B0"));
test_hash(&nettle_sha3_256, /* 12 octets */
SHEX("5BE43C90F22902E4FE8ED2D3"),
SHEX("0F53BE55990780B3FAD9870F04F7D8153C3AE605C057C85ABB5D71765043AAA8"));
test_hash(&nettle_sha3_256, /* 13 octets */
SHEX("A746273228122F381C3B46E4F1"),
SHEX("32215AE88204A782B62D1810D945DE49948DE458600F5E1E3896CECA2ED3292B"));
test_hash(&nettle_sha3_256, /* 14 octets */
SHEX("3C5871CD619C69A63B540EB5A625"),
SHEX("9510DA68E58EBB8D2AB9DE8485BB408E358299A9C011AE8544B0D0FAF9D4A4EA"));
test_hash(&nettle_sha3_256, /* 15 octets */
SHEX("FA22874BCC068879E8EF11A69F0722"),
SHEX("F20B3BCF743AA6FA084038520791C364CB6D3D1DD75841F8D7021CD98322BD8F"));
test_hash(&nettle_sha3_256, /* 16 octets */
SHEX("52A608AB21CCDD8A4457A57EDE782176"),
SHEX("0E32DEFA2071F0B5AC0E6A108B842ED0F1D3249712F58EE0DDF956FE332A5F95"));
test_hash(&nettle_sha3_256, /* 17 octets */
SHEX("82E192E4043DDCD12ECF52969D0F807EED"),
SHEX("9204550677B9AA770E6E93E319B9958540D54FF4DCCB063C8561302CD8AFF676"));
test_hash(&nettle_sha3_256, /* 18 octets */
SHEX("75683DCB556140C522543BB6E9098B21A21E"),
SHEX("A6D5444CB7AA61F5106CDEDB39D5E1DD7D608F102798D7E818AC87289123A1DB"));
test_hash(&nettle_sha3_256, /* 19 octets */
SHEX("06E4EFE45035E61FAAF4287B4D8D1F12CA97E5"),
SHEX("5796B993D0BD1257CF26782B4E58FAFB22B0986D88684AB5A2E6CEC6706275F9"));
test_hash(&nettle_sha3_256, /* 20 octets */
SHEX("E26193989D06568FE688E75540AEA06747D9F851"),
SHEX("CFBE73C6585BE6204DD473ABE356B539477174C4B770BFC91E9FDBCBC57086E6"));
test_hash(&nettle_sha3_256, /* 21 octets */
SHEX("D8DC8FDEFBDCE9D44E4CBAFE78447BAE3B5436102A"),
SHEX("31C8006B0EC35E690674297CB27476DB6066B5FA9825C60728E9E0BB338FB7C3"));
test_hash(&nettle_sha3_256, /* 22 octets */
SHEX("57085FD7E14216AB102D8317B0CB338A786D5FC32D8F"),
SHEX("3B8FA3904FE1B837565A50D0FBF03E487D6D72FC3CEA41ADCCE33DF1B835D247"));
test_hash(&nettle_sha3_256, /* 23 octets */
SHEX("A05404DF5DBB57697E2C16FA29DEFAC8AB3560D6126FA0"),
SHEX("37FEBC4DF9D50DAEABD0CAA6578812A687E55F1AC0B109D2512810D00548C85B"));
test_hash(&nettle_sha3_256, /* 24 octets */
SHEX("AECBB02759F7433D6FCB06963C74061CD83B5B3FFA6F13C6"),
SHEX("2329810B5A4735BCD49C10E6456C0B1DED5EAC258AF47CBB797CA162AB6D1BA8"));
test_hash(&nettle_sha3_256, /* 25 octets */
SHEX("AAFDC9243D3D4A096558A360CC27C8D862F0BE73DB5E88AA55"),
SHEX("6FFFA070B865BE3EE766DC2DB49B6AA55C369F7DE3703ADA2612D754145C01E6"));
test_hash(&nettle_sha3_256, /* 26 octets */
SHEX("7BC84867F6F9E9FDC3E1046CAE3A52C77ED485860EE260E30B15"),
SHEX("B30761C053E926F150B9DCE7E005B4D87811CCFB9E3B6EDB0221022F01711CF0"));
test_hash(&nettle_sha3_256, /* 27 octets */
SHEX("FAC523575A99EC48279A7A459E98FF901918A475034327EFB55843"),
SHEX("04F1B3C1E25BA5D012E22AD144E5A8719D94322D05AD9EF61E7DB49B59959B3A"));
test_hash(&nettle_sha3_256, /* 28 octets */
SHEX("0F8B2D8FCFD9D68CFFC17CCFB117709B53D26462A3F346FB7C79B85E"),
SHEX("AEEF4B4DA420834FFCED26DB291248FB2D01E765E2B0564057F8E6C2030AC37F"));
test_hash(&nettle_sha3_256, /* 29 octets */
SHEX("A963C3E895FF5A0BE4824400518D81412F875FA50521E26E85EAC90C04"),
SHEX("03D26AEEB4A7BDDDBFF7CFF667198C425941A2776922DF2BEC545F5304E2C61C"));
test_hash(&nettle_sha3_256, /* 30 octets */
SHEX("03A18688B10CC0EDF83ADF0A84808A9718383C4070C6C4F295098699AC2C"),
SHEX("435CFC0D1AFD8D5509A9CCBF49706575038685BF08DB549D9714548240463EE9"));
test_hash(&nettle_sha3_256, /* 31 octets */
SHEX("84FB51B517DF6C5ACCB5D022F8F28DA09B10232D42320FFC32DBECC3835B29"),
SHEX("D477FB02CAAA95B3280EC8EE882C29D9E8A654B21EF178E0F97571BF9D4D3C1C"));
test_hash(&nettle_sha3_256, /* 32 octets */
SHEX("9F2FCC7C90DE090D6B87CD7E9718C1EA6CB21118FC2D5DE9F97E5DB6AC1E9C10"),
SHEX("24DD2EE02482144F539F810D2CAA8A7B75D0FA33657E47932122D273C3F6F6D1"));
test_hash(&nettle_sha3_256, /* 33 octets */
SHEX("DE8F1B3FAA4B7040ED4563C3B8E598253178E87E4D0DF75E4FF2F2DEDD5A0BE046"),
SHEX("E78C421E6213AFF8DE1F025759A4F2C943DB62BBDE359C8737E19B3776ED2DD2"));
test_hash(&nettle_sha3_256, /* 34 octets */
SHEX("62F154EC394D0BC757D045C798C8B87A00E0655D0481A7D2D9FB58D93AEDC676B5A0"),
SHEX("CCE3E3D498328A4D9C5B4DBF9A1209628AB82621AD1A0D0A18680362889E6164"));
test_hash(&nettle_sha3_256, /* 35 octets */
SHEX("B2DCFE9FF19E2B23CE7DA2A4207D3E5EC7C6112A8A22AEC9675A886378E14E5BFBAD4E"),
SHEX("F871DB93C5C92ECD65D4EDB96FCB12E4729BC2A1899F7FB029F50BFF431CBB72"));
test_hash(&nettle_sha3_256, /* 36 octets */
SHEX("47F5697AC8C31409C0868827347A613A3562041C633CF1F1F86865A576E02835ED2C2492"),
SHEX("4EB143477431DF019311AED936CAB91A912EC1E6868B71E9EDDB777408D4AF34"));
test_hash(&nettle_sha3_256, /* 37 octets */
SHEX("512A6D292E67ECB2FE486BFE92660953A75484FF4C4F2ECA2B0AF0EDCDD4339C6B2EE4E542"),
SHEX("9A0C1D50A59DBF657F6713C795ED14E1F23B4EAA137C5540AACDB0A7E32C29FC"));
test_hash(&nettle_sha3_256, /* 38 octets */
SHEX("973CF2B4DCF0BFA872B41194CB05BB4E16760A1840D8343301802576197EC19E2A1493D8F4FB"),
SHEX("BA062E5D370216D11985C4CA7A2658DDC7328B4BE4B40A52DD8FA3CA662F09D1"));
test_hash(&nettle_sha3_256, /* 39 octets */
SHEX("80BEEBCD2E3F8A9451D4499961C9731AE667CDC24EA020CE3B9AA4BBC0A7F79E30A934467DA4B0"),
SHEX("3A083AE163DF42BD51B9C664BEE9DC4362F16E63383DF16473DF71BE6DD40C1C"));
test_hash(&nettle_sha3_256, /* 40 octets */
SHEX("7ABAA12EC2A7347674E444140AE0FB659D08E1C66DECD8D6EAE925FA451D65F3C0308E29446B8ED3"),
SHEX("4876E273AC00942576D9608D5B63ECC9A3E75D5E0C42C6ABDBCDE037785AF9A7"));
test_hash(&nettle_sha3_256, /* 41 octets */
SHEX("C88DEE9927679B8AF422ABCBACF283B904FF31E1CAC58C7819809F65D5807D46723B20F67BA610C2B7"),
SHEX("4797BA1C7AB7197050D6B2E506F2DF4550E4B673DF78F18C465424E48DF5E997"));
test_hash(&nettle_sha3_256, /* 42 octets */
SHEX("01E43FE350FCEC450EC9B102053E6B5D56E09896E0DDD9074FE138E6038210270C834CE6EADC2BB86BF6"),
SHEX("41C91BE98C5813A4C5D8AE7C29B9919C1CC95B4A05F82433948CB99D9A6D039C"));
test_hash(&nettle_sha3_256, /* 43 octets */
SHEX("337023370A48B62EE43546F17C4EF2BF8D7ECD1D49F90BAB604B839C2E6E5BD21540D29BA27AB8E309A4B7"),
SHEX("EE354290E3F9CE9123C49BA616E1A2684A90F3DDD84E73A1D2C232F740412B18"));
test_hash(&nettle_sha3_256, /* 44 octets */