Crate holo_hash[][src]

Defines HoloHash and its various HashTypes

Re-exports

pub use encode::holo_hash_decode;
pub use encode::holo_hash_decode_unchecked;
pub use encode::holo_hash_encode;
pub use hash_b64::*;
pub use hash_type::HashType;

Modules

encode

Include nice string encoding methods and From impls

error

HoloHash Error Type.

fixt
hash_b64

Implements base-64 serialization for HoloHashes

hash_type

Defines the prefixes for the various HashTypes, as well as the traits which unify them

Macros

assert_length

Helper for ensuring the the proper number of bytes is used in various situations

impl_hashable_content

A default HashableContent implementation, suitable for content which is already TryInto, and uses a PrimitiveHashType

Structs

EntryHashes

A newtype for a collection of EntryHashes, needed for some wasm return types.

HoloHash

A HoloHash contains a vector of 36 bytes representing a 32-byte blake2b hash plus 4 bytes representing a DHT location. It also contains a zero-sized type which specifies what it is a hash of.

HoloHashed

Represents some piece of content along with its hash representation, so that hashes need not be calculated multiple times. Provides an easy constructor which consumes the content.

Enums

HashableContentBytes

HashableContent can be expressed as “content”, or “prehashed”, which affects how a HoloHashed type will be constructed from it.

Constants

HOLO_HASH_CORE_LEN

Length of the core bytes (32)

HOLO_HASH_FULL_LEN

Length of the full HoloHash bytes (39 = 3 + 32 + 4)

HOLO_HASH_LOC_LEN

Length of the location bytes (4)

HOLO_HASH_PREFIX_LEN

Length of the prefix bytes (3)

HOLO_HASH_UNTYPED_LEN

Length of the core bytes + the loc bytes (36 = 32 + 4), i.e. everything except the type prefix

Traits

HasHash

Anything which has an owned HoloHashOf.

HashableContent

Any implementor of HashableContent may be used in a HoloHashed to pair data with its HoloHash representation. It also has an associated HashType.

PrimitiveHashType

A PrimitiveHashType is one with a multihash prefix. In contrast, a non-primitive hash type could be one of several primitive types, e.g. an AnyDhtHash can represent one of three primitive types.

Type Definitions

AgentPubKey

An Agent public signing key. Not really a hash, more of an “identity hash”.

AnyDhtHash

The hash of anything referrable in the DHT. This is a composite of either an EntryHash or a HeaderHash

DhtOpHash

The hash of a DhtOp’s “unique form” representation

DnaHash

The hash of a DnaDef

EntryHash

The hash of an Entry.

HeaderHash

The hash of a Header

HoloHashOf

A convenience type, for specifying a hash by HashableContent rather than by its HashType

NetIdHash

The hash of a network ID

WasmHash

The hash of some wasm bytecode