What version of Go are you using (go version)?
$ go version
go version go1.19.1 darwin/amd64
# but please note that it's not relevant, since I'm providing references and links to go1.20.4 below.
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GOARCH="amd64"
GOOS="darwin"
# other values are irrelevant in this case
What did you do?
Browsing src/crypto/crypto.go, I've noticed that RegisterHash doesn't not validate the Hash argument in the same fashion as the rest of the package.
What did you expect to see?
I expected RegisterHash to validate that the Hash argument is bigger than 0, as the smallest Hash value defined in the package is uint 1 (MD4, which is defined with 1 + iota).
I though it's this way intentionally ...
What did you see instead?
Digging in a bit more, and trying to find an explanation or a legit use, I failed, leading me to believe that it's not intentional.
I might be wrong, since I'm not super experienced with the package, but I expect to see a comment addressing the exceptional check if it was by design.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Browsing
src/crypto/crypto.go, I've noticed thatRegisterHashdoesn't not validate theHashargument in the same fashion as the rest of the package.What did you expect to see?
I expected
RegisterHashto validate that theHashargument is bigger than 0, as the smallestHashvalue defined in the package isuint 1(MD4, which is defined with1 + iota).I though it's this way intentionally ...
What did you see instead?
Digging in a bit more, and trying to find an explanation or a legit use, I failed, leading me to believe that it's not intentional.
I might be wrong, since I'm not super experienced with the package, but I expect to see a comment addressing the exceptional check if it was by design.