HomePhabricator

Implement Keccak and SHA3_256

Description

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

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9185

Details

Provenance
Pieter Wuille <pieter@wuille.net>Authored on Aug 30 2020, 19:54
FabienCommitted on Feb 9 2021, 17:03
FabienPushed on Feb 9 2021, 17:05
Reviewer
Restricted Project
Differential Revision
D9185: Implement Keccak and SHA3_256
Parents
rABCc78ecba78410: net: CNetAddr: add support to (un)serialize as ADDRv2
Branches
Unknown
Tags
Unknown