The hash datatype represents the digest result of a hashing algorithm.

type Hash =
  , functionType : UVarInt
  , digestLength : UInt
  , digest : List Byte

The string representation MUST be in hexadecimal and it MUST prepend the function type and digest length defined by the hashing algorithm according to the multihash pattern:


For example, the SHA2-256 digest for foo represented in hexadecimal is:


And given that SHA2-256 has the function type 0x12 and the digest length is 0x20 the final string representation is:


The algorithm for hashing blobs and the one for hashing entries describe in detail how to apply the hashing algorithm in each case.

© Crown copyright released under the Open Government Licence.