hyperledger/fabric · error
Unknown hashing algorithm type: %s
Error message
Unknown hashing algorithm type: %s
What it means
ChannelConfig's hashing algorithm is validated against the BCCSP-supported list: only SHA256 and SHA3_256 are accepted. Any other value in the HashingAlgorithm config value causes validateHashingAlgorithm to return "Unknown hashing algorithm type: %s". The field controls how block data is hashed chain-wide, so it must match a supported primitive.
Source
Thrown at common/channelconfig/channel.go:206
}
}
// We validate no global endpoints at V3_0 or above
if channelCapabilities.ConsensusTypeBFT() {
return cc.validateNoOrdererAddresses()
}
return nil
}
func (cc *ChannelConfig) validateHashingAlgorithm() error {
switch cc.protos.HashingAlgorithm.Name {
case bccsp.SHA256:
cc.hashingAlgorithm = util.ComputeSHA256
case bccsp.SHA3_256:
cc.hashingAlgorithm = util.ComputeSHA3256
default:
return fmt.Errorf("Unknown hashing algorithm type: %s", cc.protos.HashingAlgorithm.Name)
}
return nil
}
func (cc *ChannelConfig) validateBlockDataHashingStructure() error {
if cc.protos.BlockDataHashingStructure.Width != math.MaxUint32 {
return fmt.Errorf("BlockDataHashStructure width only supported at MaxUint32 in this version")
}
return nil
}
func (cc *ChannelConfig) validateOrdererAddresses() error {
if len(cc.protos.OrdererAddresses.Addresses) == 0 {
return fmt.Errorf("Must set some OrdererAddresses")
}
return nil
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Set HashingAlgorithm to SHA256 in configtx.yaml (the standard) and regenerate the config
- Use SHA3_256 only if the network explicitly requires it
- Fix case sensitivity — the comparison is exact ("SHA256", not "sha256")
- If the value is empty, add the HashingAlgorithm value to the Channel group
Example fix
# before
Channel:
HashingAlgorithm: sha256
# after
Channel:
HashingAlgorithm: SHA256 Defensive patterns
Strategy: validation
Validate before calling
func hashingAlgorithmSupported(name string) bool {
return name == bccsp.SHA256 || name == bccsp.SHA3_256
}
// check the decoded value before NewBundle/NewChannelConfig Try / catch
cc, err := channelconfig.NewChannelConfig(channelGroup, bccsp)
if err != nil {
if strings.Contains(err.Error(), "Unknown hashing algorithm") {
return fmt.Errorf("set HashingAlgorithm to SHA256 and resubmit")
}
return err
} Prevention
- Use SHA256 in configtx.yaml unless the network explicitly requires SHA3_256
- Respect exact case: SHA256 / SHA3_256
- Never leave the HashingAlgorithm value empty in generated configs
When it happens
Trigger: channelGroup's HashingAlgorithm config value has a Name other than "SHA256" or "SHA3_256" — e.g. "sha256" (wrong case), "SHA512", "MD5", or an empty/zero-value proto. Reached via NewChannelConfig→Validate chain (TestHashingAlgorithm exercises it directly).
Common situations: Typo or wrong case in a hand-edited config (proto fields are case-sensitive); copying config from another blockchain framework; HashingAlgorithm value left unset so Name is ""; experimental algorithm not supported by BCCSP.
Related errors
- BlockDataHashStructure width only supported at MaxUint32 in
- Internal error, BCCSP could not be initialized : %s
- found unknown private key type (%T) in msg signing
- found unknown private key type (%T) in PKCS#8 wrapping
- failed to parse private key: %v
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/dd2fe6228533f61d.
Report an issue: GitHub.