Hash

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:

<functionType><digestLength><digest>

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

2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae

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

12202c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae

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.