A managed .NET 10 implementation of the Keccak family (224 / 256 / 384 / 512) using the original Keccak padding adopted by Ethereum — not FIPS-202 SHA-3. Allocation-free ref struct hasher, fully unrolled Keccak-f[1600], Span-based API.
using Texnomic.Keccak;
byte[] Digest = Keccak.Hash256("abc"u8);
// 4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45
Console.WriteLine(Convert.ToHexString(Digest));
HashAlgorithm.A familiar managed surface, allocation-free under the hood. Every hash matches the Keccak variant that Ethereum and the EVM speak — not the post-FIPS SHA-3.
The 0x01 .. 0x80 padding rule used by Ethereum, Solidity keccak256, and the EVM — distinct from FIPS-202 SHA-3's 0x06 .. 0x80.
A ref struct hasher backed by inline arrays. State and buffer live on the stack — no array-pool rentals, no GC traffic.
ReadOnlySpan<byte> in, Span<byte> out. Hash UTF-8 literals ("abc"u8), stack-allocated buffers, or slices — no copies.
Keccak-f[1600] with 24 inlined rounds across all 25 lanes. Hot for the JIT, friendly to the branch predictor.
Standard Keccak vectors (empty, "abc", 1 M a) plus incremental-vs-one-shot equivalence across all four digest sizes.
Nullable-enabled, inline arrays, TreatWarningsAsErrors, deterministic builds, SourceLink, and symbol packages.
Pick the digest size you need — the rate adjusts automatically (r = 1600 - 2d). Same Keccak-f[1600] core under all four.
28-byte digest. Rate 1152 bits. Keccak.Hash224 or KeccakSize.Bits224.
32-byte digest. Rate 1088 bits. Ethereum's hash — addresses, EIP-712, Solidity keccak256.
48-byte digest. Rate 832 bits. Keccak.Hash384 or KeccakSize.Bits384.
64-byte digest. Rate 576 bits. Keccak.Hash512 or KeccakSize.Bits512.
KeccakHasher.Update(...) across any number of chunks. Stream files, network frames, or buffered protocol messages.
Keccak.Hash(Data, KeccakSize.BitsXxx) — pick the width at runtime from a config value or protocol field.
No native dependency. No P/Invoke. Just a NuGet install and a Span-shaped API.
Pure managed code — runs anywhere .NET 10 runs.
$ dotnet add package Texnomic.Keccak
Static helpers cover all four widths. Hash UTF-8 literals, byte arrays, or any ReadOnlySpan<byte>.
using Texnomic.Keccak;
byte[] D224 = Keccak.Hash224(Data); // 28 bytes
byte[] D256 = Keccak.Hash256(Data); // 32 bytes — Ethereum's hash
byte[] D384 = Keccak.Hash384(Data); // 48 bytes
byte[] D512 = Keccak.Hash512(Data); // 64 bytes
// Or hash into a caller-supplied buffer (zero allocation):
Span<byte> Out = stackalloc byte[32];
Keccak.HashTo("abc"u8, KeccakSize.Bits256, Out);
For multi-chunk inputs use the incremental KeccakHasher. It's a ref struct — lives on the stack, no GC pressure.
KeccakHasher Hasher = new(KeccakSize.Bits256);
Hasher.Update(BlockA);
Hasher.Update(BlockB);
Span<byte> Digest = stackalloc byte[32];
Hasher.Finish(Digest);
Keccak is a sponge: the message is absorbed into a 1600-bit state in r-bit blocks, then the digest is squeezed out. The padding byte is the only thing that separates this from FIPS-202 SHA-3.
No native dependency, no per-RID sub-package. Runs anywhere .NET 10 runs — including Native AOT.
No runtime sub-packages. No native binaries. Just install Texnomic.Keccak and start hashing.
keccak256 in .NET?Install the package. Hash a span. Get back the exact bytes that the EVM would.