sha3

sha3 - cryptographic hash function


Need help? Read Nimble

SHA3 Library

Test

A comprehensive SHA3 implementation for Nim, supporting all SHA3 variants and KangarooTwelve.

Features

  • SHA3 Variants: SHA3_224, SHA3_256, SHA3_384, SHA3_512, SHA3_SHAKE128, SHA3_SHAKE256
  • KangarooTwelve: Fast hashing algorithm (available since v0.6)
  • Comprehensive Testing: Extensive test suite with official test vectors
  • Easy to Use: Simple API for both incremental and one-shot hashing

Installation

nimble install sha3

Usage

Basic SHA3 Hashing

import sha3

var ctx: SHA3

sha3_init(ctx, SHA3_224, 4)
sha3_update(ctx, "a", 1)
sha3_update(ctx, "b", 1)
sha3_update(ctx, "c", 1)
assert(getSHA3(SHA3_224, "abc", 4) == $sha3_final(ctx))

KangarooTwelve

Since version 0.6, KangarooTwelve is supported:

import sha3

var ktx: Kangaroo12

sha3_init(ktx, 8, "keykey", 6)
sha3_update(ktx, "Mike", 4)
assert($sha3_final(ktx) == "285f85b139eb449b")
assert(getSHA3("Kangaroo12 is fast", 5) == "d793340e68")

License

This project is released under the CC0 License - public domain dedication.