go/crypto/sha3 : embedding SHA3 and HKDF drawbacks (NIST Standard not fulfilled) #71900
Labels
BugReport
Issues describing a possible bug in the Go implementation.
Milestone
Go version
go1.24 all versions
Output of
go env
in your module/workspace:What did you do?
I tried to use golang/x/crypto/sha3 (and shake) against the NIST bit-oriented test vectors, i.e.
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/sha3/sha3vs.pdf
chapters 6.2.1.1, 6.2.2.1, 6.3.1.1, 6.3.2.1, that are no less important than the byte oriented cases and integrant part of the NIST standard.
What did you see happen?
The embedding of SHA3 and HKDF in golang/crypto is definitely a great thing, but there is a major drawback: the implementation always lacked the "non-byte-complete" feature, implementing partially the NIST specification.
As external x package is was not straight but relatively easy to complete the missing code, implementing correctly the padding function, which is currently compliant only if with the "entire number of bytes" subcase.
Personally I inserted a new primitive "WriteLastByteFractionAndSum" in SHA3, SHAKE, KMAC, HKDF, etc....
Now that the code is "inside", there is a big obstacle in releasing code doing that,
What did you expect to see?
The insertion of primitives to add BITS to the stream to hash or at least to complete the last byte fraction before summing.
The text was updated successfully, but these errors were encountered: