Commit 5e36877d authored by Adam Langley's avatar Adam Langley

crypto: include hash number in panic message.

In the event that code tries to use a hash function that isn't compiled
in and panics, give the developer a fighting chance of figuring out
which hash function it needed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12420045
parent 6abbbcdc
......@@ -7,6 +7,7 @@ package crypto
import (
"hash"
"strconv"
)
// Hash identifies a cryptographic hash function that is implemented in another
......@@ -59,7 +60,7 @@ func (h Hash) New() hash.Hash {
return f()
}
}
panic("crypto: requested hash function is unavailable")
panic("crypto: requested hash function #" + strconv.Itoa(int(h)) + " is unavailable")
}
// Available reports whether the given hash function is linked into the binary.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment