Struct simplicity::Tmr
source · pub struct Tmr(/* private fields */);Expand description
Type Merkle root
A Merkle root that commits to a type’s primitive (unit, sum, product) and recursively its sub-types.
Uniquely identifies a type.
Implementations§
source§impl Tmr
impl Tmr
sourcepub fn update(self, left: Self, right: Self) -> Self
pub fn update(self, left: Self, right: Self) -> Self
Extend the given tagged hash by the given left and right hashes.
The hash self is taken as initial value,
left and right hash are combined to create a 512-bit block,
and the compression function is run once
sourcepub fn update_1(self, right: Self) -> Self
pub fn update_1(self, right: Self) -> Self
Extend the given tagged hash by 256 bits of zeroes and the right hash.
The hash self is taken as initial value,
256 bits of zeroes and right hash are combined to create a 512-bit block,
and the compression function is run once
sourcepub fn update_with_weight(self, left_weight: u64, right: Self) -> Self
pub fn update_with_weight(self, left_weight: u64, right: Self) -> Self
Updates the given tagged hash with given left cost and right hash.
The cost is serialized as the last 64 bits in the left block
pub fn update_fail_entropy(self, entropy: FailEntropy) -> Self
sourcepub fn from_byte_array(data: [u8; 32]) -> Self
pub fn from_byte_array(data: [u8; 32]) -> Self
Converts the given tagged hash into a byte array
sourcepub fn to_byte_array(self) -> [u8; 32]
pub fn to_byte_array(self) -> [u8; 32]
Converts the given tagged hash into a byte array
source§impl Tmr
impl Tmr
sourcepub const PRODUCT_IV: Tmr = _
pub const PRODUCT_IV: Tmr = _
The IV for a TMR of a product type
sourcepub const POWERS_OF_TWO: [Tmr; 32] = _
pub const POWERS_OF_TWO: [Tmr; 32] = _
The TMRs of the types TWO^(2^n) for small values of n
Trait Implementations§
source§impl Ord for Tmr
impl Ord for Tmr
source§impl PartialOrd for Tmr
impl PartialOrd for Tmr
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more