Skip to main content

Crate ai_hash

Crate ai_hash 

Source
Expand description

Defines AiHash and its various HashTypes

Re-exports§

pub use encode::ai_hash_decode;
pub use encode::ai_hash_decode_unchecked;
pub use encode::ai_hash_encode;
pub use hash_type::HashType;
pub use hash_type::PrimitiveHashType;
pub use hash_b64::*;

Modules§

encode
Include nice string encoding methods and From impls
error
AiHash Error Type.
fixt
hash_b64
Implements base-64 serialization for AiHashes
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§

AiHash
A AiHash contains a vector of 36 bytes representing a 32-byte blake2b hash plus 4 bytes representing a SGD location. It also contains a zero-sized type which specifies what it is a hash of.
AiHashed
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.
EntryHashes
A newtype for a collection of EntryHashes, needed for some wasm return types.

Enums§

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

Constants§

AI_HASH_CORE_LEN
Length of the core bytes (32)
AI_HASH_FULL_LEN
Length of the full AiHash bytes (39 = 3 + 32 + 4)
AI_HASH_LOC_LEN
Length of the location bytes (4)
AI_HASH_PREFIX_LEN
Length of the prefix bytes (3)
AI_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 AiHashOf.
HashableContent
Any implementor of HashableContent may be used in a AiHashed to pair data with its AiHash representation. It also has an associated HashType.

Type Aliases§

AgentPubKey
An Agent public signing key. Not really a hash, more of an “identity hash”.
AiHashOf
A convenience type, for specifying a hash by HashableContent rather than by its HashType
AnySgdHash
The hash of anything referrable in the SGD. This is a composite of either an EntryHash or a HeaderHash
EntryHash
The hash of an Entry.
HeaderHash
The hash of a Header
NetIdHash
The hash of a network ID
SafHash
The hash of a SafDef
SgdOpHash
The hash of a SgdOp’s “unique form” representation
WasmHash
The hash of some wasm bytecode