Struct holochain_types::dna::HoloHash [−][src]
pub struct HoloHash<T> where
T: HashType, { /* fields omitted */ }
Expand description
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.
There is custom de/serialization implemented in [ser.rs]
Implementations
Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type
Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type. Panics if hash_type does not match.
Use a precomputed hash + location byte array in vec form, along with a type, to construct a hash. Used in this crate only, for testing.
Change the type of this HoloHash, keeping the same bytes
Get the raw 39-byte Vec including the 3 byte prefix, base 32 bytes, and the 4 byte loc
Get 36-byte Vec which excludes the 3 byte prefix
Fetch just the core 32 bytes (without the 4 location bytes)
Construct a HoloHash from a 32-byte hash. The 3 prefix bytes will be added based on the provided HashType, and the 4 location bytes will be computed.
For convenience, 36 bytes can also be passed in, in which case the location bytes will used as provided, not computed.
Synchronously hash a reference to the given content to produce a HoloHash If the content is larger than MAX_HASHABLE_CONTENT_LEN, this will panic!
pub async fn with_data<C>(content: &'_ C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
pub async fn with_data<C>(content: &'_ C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
Asynchronously hash a reference to the given content to produce a HoloHash
Trait Implementations
pub fn new_random(
keystore: &MetaLairClient
) -> MustBoxFuture<'static, Result<HoloHash<Agent>, OneErr>> where
HoloHash<Agent>: Sized,
pub fn new_random(
keystore: &MetaLairClient
) -> MustBoxFuture<'static, Result<HoloHash<Agent>, OneErr>> where
HoloHash<Agent>: Sized,
create a new agent keypair in given keystore, returning the AgentPubKey
pub fn sign_raw(
&self,
keystore: &MetaLairClient,
data: Arc<[u8]>
) -> MustBoxFuture<'static, Result<Signature, OneErr>>
pub fn sign_raw(
&self,
keystore: &MetaLairClient,
data: Arc<[u8]>
) -> MustBoxFuture<'static, Result<Signature, OneErr>>
sign some arbitrary raw bytes
pub fn verify_signature_raw(
&self,
signature: &Signature,
data: Arc<[u8]>
) -> MustBoxFuture<'static, bool>
pub fn verify_signature_raw(
&self,
signature: &Signature,
data: Arc<[u8]>
) -> MustBoxFuture<'static, bool>
verify a signature for given raw bytes with this agent public_key is valid
fn sign<S>(
&self,
keystore: &MetaLairClient,
input: S
) -> MustBoxFuture<'static, Result<Signature, OneErr>> where
S: Serialize + Debug,
fn sign<S>(
&self,
keystore: &MetaLairClient,
input: S
) -> MustBoxFuture<'static, Result<Signature, OneErr>> where
S: Serialize + Debug,
sign some arbitrary data
fn verify_signature<D>(
&self,
signature: &Signature,
data: D
) -> MustBoxFuture<'static, bool> where
D: TryInto<SerializedBytes, Error = SerializedBytesError>,
fn verify_signature<D>(
&self,
signature: &Signature,
data: D
) -> MustBoxFuture<'static, bool> where
D: TryInto<SerializedBytes, Error = SerializedBytesError>,
verify a signature for given data with this agent public_key is valid
pub fn deserialize<D>(
deserializer: D
) -> Result<HoloHash<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<HoloHash<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
Performs the conversion.
Converts SQLite value into Rust value.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Converts Rust value to SQLite value
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
Performs the conversion.
type Error = HoloHashError
type Error = HoloHashError
The type returned in the event of a conversion error.
type Error = HoloHashError
type Error = HoloHashError
The type returned in the event of a conversion error.
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
Performs the conversion.
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
Performs the conversion.
type Error = HoloHashError
type Error = HoloHashError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl<T> RefUnwindSafe for HoloHash<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for HoloHash<T> where
T: UnwindSafe,
Blanket Implementations
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove Any::type_id_compat and use StdAny::type_id instead. https://github.com/rust-lang/rust/issues/27745 Read more
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more