multihash.core
Core multihash type definition and helper methods.
app-code?
(app-code? code)
True if the given code number is assigned to the application-specfic range. Returns nil if the argument is not an integer.
create
(create algorithm digest)
Constructs a new Multihash identifier. Accepts either a numeric algorithm code or a keyword name as the first argument. The digest may either by a byte array or a hex string.
Decodable
protocol
This protocol provides a method for data sources which a multihash can be read from.
members
decode
(decode source)
Attempts to read a multihash value from the data source.
decode-array
(decode-array encoded)
Decodes a byte array directly into multihash. Throws ex-info
with a :type
of :multihash/bad-input
if the data is malformed or invalid.
get-algorithm
(get-algorithm value)
Looks up an algorithm by keyword name or code number. Returns nil
if the value does not map to any valid algorithm.