Page MenuHomePhabricator

Implement Keccak and SHA3_256
ClosedPublic

Authored by Fabien on Feb 9 2021, 12:00.

Details

Reviewers
majcosta
Group Reviewers
Restricted Project
Commits
rABCfc167a7f4f00: Implement Keccak and SHA3_256
Summary
Add a simple (and initially unoptimized) Keccak/SHA3 implementation
based on https://github.com/mjosaarinen/tiny_sha3/blob/master/sha3.c, as
one will be needed for TORv3 support (the conversion from BIP155
encoding to .onion notation uses a SHA3-based checksum). In follow-up
commits, a benchmark is added, and the Keccakf function is unrolled for
a (for me) 4.9x speedup.

Test vectors are taken from
https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/secure-hashing#sha3vsha3vss.

Backport of core PR19841.

Test Plan
ninja check
ninja bench-bitcoin

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable