SHA-3 (KECCAK) Erlang NIFs (based on NIST reference C implementation)
C Erlang Other
Latest commit 3acde27 Jan 19, 2015 @b Merge pull request #2 from stringsn88keys/master
Make deps as well
Failed to load latest commit information.
c_src Merge from master Oct 20, 2012
src Use hex module dep Oct 23, 2012
test Use hex module dep Oct 23, 2012
.gitignore Update gitignore Jan 8, 2013
Makefile Make deps as well Jan 19, 2015 Show use of explicit hash lifecycle calls Oct 13, 2012
rebar Initial commit Oct 13, 2012
rebar.config Merge optimized Jan 8, 2013


sha3 is a NIF wrapper around SHA-3/KECCAK cryptographic hashing function

Quick Start

You must have Erlang/OTP R14B or later and a GNU-style build system to compile and run sha3.

git clone git://
cd sha3

Start up an Erlang shell with the path to sha3 included.

cd path/to/sha3/ebin

Hash a binary by calling sha3:hash/2 with the desired number of bits for the resulting hash:

1> Bits = 256.
2> Data = <<"foobarbazquux">>.
3> {ok, Hash} = sha3:hash(Bits, Data).
4> bit_size(Hash).

Supported hash bit lengths are 224, 256, 384, and 512.

You may find sha3:hexhash/2 more useful, as it returns a hexadecimal-encoded string representing the hash:

5> HexHash = sha3:hexhash(Bits, Data).

Alternatively, you might want to incrementally hash a longer message:

6> Bits = 256.
7> Data1 = <<"foobar">>.
8> Data2 = <<"bazquux">>.
9> {ok, Handle} = sha3:init(Bits).
10> {ok, Handle} = sha3:update(Handle, Data1).
11> {ok, Handle} = sha3:update(Handle, Data2).
12> {ok, Hash} = sha3:final(Handle).
13> bit_size(Hash).

The SHA-3 Hash

The underlying hashing code in sha3 is the reference implementation of KECCAK, now SHA-3, from the official NIST submission.

Details on the algorithm as submitted and known analysis can be found at