From ffd759021357eee1af83c72c80af02bd3fc7b07e Mon Sep 17 00:00:00 2001 From: Kris Kwiatkowski Date: Tue, 25 Aug 2020 17:08:04 +0100 Subject: [PATCH] improve comment Initial speed on i7-8665U > go test -bench=. -test.cpu=1 goos: linux goarch: amd64 pkg: github.com/henrydcase/nobs/hash/sha3 BenchmarkPermutationFunction 1634836 732 ns/op 273.18 MB/s BenchmarkSha3_512_MTU 78438 15340 ns/op 88.00 MB/s BenchmarkSha3_384_MTU 108807 11025 ns/op 122.45 MB/s BenchmarkSha3_256_MTU 136902 8767 ns/op 153.98 MB/s BenchmarkSha3_224_MTU 143377 8355 ns/op 161.57 MB/s BenchmarkShake128_MTU 163569 7108 ns/op 189.94 MB/s BenchmarkShake256_MTU 156534 7643 ns/op 176.64 MB/s BenchmarkShake256_16x 10000 112109 ns/op 146.14 MB/s BenchmarkShake256_1MiB 204 5877014 ns/op 178.42 MB/s BenchmarkSha3_512_1MiB 100 10967026 ns/op 95.61 MB/s PASS ok github.com/henrydcase/nobs/hash/sha3 13.855s --- hash/sha3/sha3.go | 3 ++- hash/sha3/shake.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hash/sha3/sha3.go b/hash/sha3/sha3.go index f120ff4..92596a4 100644 --- a/hash/sha3/sha3.go +++ b/hash/sha3/sha3.go @@ -49,7 +49,8 @@ type state struct { state spongeDirection // whether the sponge is absorbing or squeezing } -// BlockSize returns the rate of sponge underlying this hash function. +// BlockSize returns block size in bytes. Corresponds to the input +// block size B of the HMAC func (d *state) BlockSize() int { return d.rate } // Size returns the output size of the hash function in bytes. diff --git a/hash/sha3/shake.go b/hash/sha3/shake.go index ef5fbc7..1742086 100644 --- a/hash/sha3/shake.go +++ b/hash/sha3/shake.go @@ -4,9 +4,8 @@ package sha3 -// This file defines the ShakeHash interface, and provides -// functions for creating SHAKE and cSHAKE instances, as well as utility -// functions for hashing bytes to arbitrary-length output. +// SHAKE128 and SHAKE256 are FIPS approved XOFs. The cSHAKE128/256 +// are SHAKE-based XOFs supporting domain separation. // // // SHAKE implementation is based on FIPS PUB 202 [1]