pub struct TapTweakHash(/* private fields */);
Expand description
Taproot-tagged hash with tag "TapTweak".
This hash type is used while computing the tweaked public key.
Implementations§
Source§impl TapTweakHash
impl TapTweakHash
Sourcepub fn from_raw_hash(inner: Hash<TapTweakTag>) -> TapTweakHash
pub fn from_raw_hash(inner: Hash<TapTweakTag>) -> TapTweakHash
Creates this wrapper type from the inner hash type.
Sourcepub fn to_raw_hash(self) -> Hash<TapTweakTag>
pub fn to_raw_hash(self) -> Hash<TapTweakTag>
Returns the inner hash (sha256, sh256d etc.).
Sourcepub fn as_raw_hash(&self) -> &Hash<TapTweakTag>
pub fn as_raw_hash(&self) -> &Hash<TapTweakTag>
Returns a reference to the inner hash (sha256, sh256d etc.).
Source§impl TapTweakHash
impl TapTweakHash
Sourcepub fn from_key_and_tweak(
internal_key: UntweakedPublicKey,
merkle_root: Option<TapNodeHash>,
) -> TapTweakHash
pub fn from_key_and_tweak( internal_key: UntweakedPublicKey, merkle_root: Option<TapNodeHash>, ) -> TapTweakHash
Creates a new BIP341 TapTweakHash
from key and tweak. Produces H_taptweak(P||R)
where
P
is the internal key and R
is the merkle root.
Trait Implementations§
Source§impl AsRef<[u8]> for TapTweakHash
impl AsRef<[u8]> for TapTweakHash
Source§impl Borrow<[u8]> for TapTweakHash
impl Borrow<[u8]> for TapTweakHash
Source§impl Clone for TapTweakHash
impl Clone for TapTweakHash
Source§fn clone(&self) -> TapTweakHash
fn clone(&self) -> TapTweakHash
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TapTweakHash
impl Debug for TapTweakHash
Source§impl<'de> Deserialize<'de> for TapTweakHash
impl<'de> Deserialize<'de> for TapTweakHash
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<TapTweakHash, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<TapTweakHash, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for TapTweakHash
impl Display for TapTweakHash
Source§impl From<&TaprootSpendInfo> for TapTweakHash
impl From<&TaprootSpendInfo> for TapTweakHash
Source§fn from(spend_info: &TaprootSpendInfo) -> TapTweakHash
fn from(spend_info: &TaprootSpendInfo) -> TapTweakHash
Converts to this type from the input type.
Source§impl From<Hash<TapTweakTag>> for TapTweakHash
impl From<Hash<TapTweakTag>> for TapTweakHash
Source§fn from(inner: Hash<TapTweakTag>) -> TapTweakHash
fn from(inner: Hash<TapTweakTag>) -> TapTweakHash
Converts to this type from the input type.
Source§impl From<TapTweakHash> for Hash<TapTweakTag>
impl From<TapTweakHash> for Hash<TapTweakTag>
Source§fn from(hashtype: TapTweakHash) -> Hash<TapTweakTag>
fn from(hashtype: TapTweakHash) -> Hash<TapTweakTag>
Converts to this type from the input type.
Source§impl From<TaprootSpendInfo> for TapTweakHash
impl From<TaprootSpendInfo> for TapTweakHash
Source§fn from(spend_info: TaprootSpendInfo) -> TapTweakHash
fn from(spend_info: TaprootSpendInfo) -> TapTweakHash
Converts to this type from the input type.
Source§impl FromStr for TapTweakHash
impl FromStr for TapTweakHash
Source§impl Hash for TapTweakHash
impl Hash for TapTweakHash
Source§impl Hash for TapTweakHash
impl Hash for TapTweakHash
Source§const DISPLAY_BACKWARD: bool = false
const DISPLAY_BACKWARD: bool = false
Flag indicating whether user-visible serializations of this hash
should be backward. For some reason Satoshi decided this should be
true for
Sha256dHash
, so here we are.Source§type Engine = <Hash<TapTweakTag> as Hash>::Engine
type Engine = <Hash<TapTweakTag> as Hash>::Engine
A hashing engine which bytes can be serialized into. It is expected
to implement the
io::Write
trait, and to never return errors under
any conditions.Source§type Bytes = <Hash<TapTweakTag> as Hash>::Bytes
type Bytes = <Hash<TapTweakTag> as Hash>::Bytes
The byte array that represents the hash internally.
Source§fn from_engine(e: Self::Engine) -> Self
fn from_engine(e: Self::Engine) -> Self
Produces a hash from the current state of a given engine.
Source§fn from_slice(sl: &[u8]) -> Result<TapTweakHash, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<TapTweakHash, FromSliceError>
Copies a byte slice into a hash object.
Source§fn from_byte_array(bytes: Self::Bytes) -> Self
fn from_byte_array(bytes: Self::Bytes) -> Self
Constructs a hash from the underlying byte array.
Source§fn to_byte_array(self) -> Self::Bytes
fn to_byte_array(self) -> Self::Bytes
Returns the underlying byte array.
Source§fn as_byte_array(&self) -> &Self::Bytes
fn as_byte_array(&self) -> &Self::Bytes
Returns a reference to the underlying byte array.
Source§fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
Hashes all the byte slices retrieved from the iterator together.
Source§impl<I: SliceIndex<[u8]>> Index<I> for TapTweakHash
impl<I: SliceIndex<[u8]>> Index<I> for TapTweakHash
Source§impl LowerHex for TapTweakHash
impl LowerHex for TapTweakHash
Source§impl Ord for TapTweakHash
impl Ord for TapTweakHash
Source§fn cmp(&self, other: &TapTweakHash) -> Ordering
fn cmp(&self, other: &TapTweakHash) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for TapTweakHash
impl PartialEq for TapTweakHash
Source§impl PartialOrd for TapTweakHash
impl PartialOrd for TapTweakHash
Source§impl SerdeHash for TapTweakHash
impl SerdeHash for TapTweakHash
Source§fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>
Helper function to turn a deserialized slice into the correct hash type.
Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Do serde serialization.
Source§fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Do serde deserialization.
Source§impl Serialize for TapTweakHash
impl Serialize for TapTweakHash
Source§impl UpperHex for TapTweakHash
impl UpperHex for TapTweakHash
impl Copy for TapTweakHash
impl Eq for TapTweakHash
impl StructuralPartialEq for TapTweakHash
Auto Trait Implementations§
impl Freeze for TapTweakHash
impl RefUnwindSafe for TapTweakHash
impl Send for TapTweakHash
impl Sync for TapTweakHash
impl Unpin for TapTweakHash
impl UnwindSafe for TapTweakHash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)