Struct nostr_sdk::bitcoin::taproot::TapTweakHash
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§
§impl TapTweakHash
impl TapTweakHash
pub 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.
pub fn to_raw_hash(self) -> Hash<TapTweakTag>
pub fn to_raw_hash(self) -> Hash<TapTweakTag>
Returns the inner hash (sha256, sh256d etc.).
pub 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.).
§impl TapTweakHash
impl TapTweakHash
pub fn from_key_and_tweak(
internal_key: XOnlyPublicKey,
merkle_root: Option<TapNodeHash>
) -> TapTweakHash
pub fn from_key_and_tweak( internal_key: XOnlyPublicKey, 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§
§impl AsRef<[u8]> for TapTweakHash
impl AsRef<[u8]> for TapTweakHash
§impl AsRef<[u8; 32]> for TapTweakHash
impl AsRef<[u8; 32]> for TapTweakHash
§impl Borrow<[u8]> for TapTweakHash
impl Borrow<[u8]> for TapTweakHash
§impl Clone for TapTweakHash
impl Clone for TapTweakHash
§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 more§impl Debug for TapTweakHash
impl Debug for TapTweakHash
§impl<'de> Deserialize<'de> for TapTweakHash
impl<'de> Deserialize<'de> for TapTweakHash
§fn deserialize<D>(d: D) -> Result<TapTweakHash, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<TapTweakHash, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for TapTweakHash
impl Display for TapTweakHash
§impl From<&TaprootSpendInfo> for TapTweakHash
impl From<&TaprootSpendInfo> for TapTweakHash
§fn from(spend_info: &TaprootSpendInfo) -> TapTweakHash
fn from(spend_info: &TaprootSpendInfo) -> TapTweakHash
Converts to this type from the input type.
§impl From<Hash<TapTweakTag>> for TapTweakHash
impl From<Hash<TapTweakTag>> for TapTweakHash
§fn from(inner: Hash<TapTweakTag>) -> TapTweakHash
fn from(inner: Hash<TapTweakTag>) -> TapTweakHash
Converts to this type from the input type.
§impl From<TapTweakHash> for Hash<TapTweakTag>
impl From<TapTweakHash> for Hash<TapTweakTag>
§fn from(hashtype: TapTweakHash) -> Hash<TapTweakTag>
fn from(hashtype: TapTweakHash) -> Hash<TapTweakTag>
Converts to this type from the input type.
§impl From<TaprootSpendInfo> for TapTweakHash
impl From<TaprootSpendInfo> for TapTweakHash
§fn from(spend_info: TaprootSpendInfo) -> TapTweakHash
fn from(spend_info: TaprootSpendInfo) -> TapTweakHash
Converts to this type from the input type.
§impl FromStr for TapTweakHash
impl FromStr for TapTweakHash
§impl Hash for TapTweakHash
impl Hash for TapTweakHash
§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.§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.§fn engine() -> <TapTweakHash as Hash>::Engine
fn engine() -> <TapTweakHash as Hash>::Engine
Constructs a new engine.
§fn from_engine(e: <TapTweakHash as Hash>::Engine) -> TapTweakHash
fn from_engine(e: <TapTweakHash as Hash>::Engine) -> TapTweakHash
Produces a hash from the current state of a given engine.
§fn from_slice(sl: &[u8]) -> Result<TapTweakHash, Error>
fn from_slice(sl: &[u8]) -> Result<TapTweakHash, Error>
Copies a byte slice into a hash object.
§fn from_byte_array(bytes: <TapTweakHash as Hash>::Bytes) -> TapTweakHash
fn from_byte_array(bytes: <TapTweakHash as Hash>::Bytes) -> TapTweakHash
Constructs a hash from the underlying byte array.
§fn to_byte_array(self) -> <TapTweakHash as Hash>::Bytes
fn to_byte_array(self) -> <TapTweakHash as Hash>::Bytes
Returns the underlying byte array.
§fn as_byte_array(&self) -> &<TapTweakHash as Hash>::Bytes
fn as_byte_array(&self) -> &<TapTweakHash as Hash>::Bytes
Returns a reference to the underlying byte array.
§fn all_zeros() -> TapTweakHash
fn all_zeros() -> TapTweakHash
Returns an all zero hash. Read more
§impl Hash for TapTweakHash
impl Hash for TapTweakHash
§impl<I> Index<I> for TapTweakHashwhere
I: SliceIndex<[u8]>,
impl<I> Index<I> for TapTweakHashwhere I: SliceIndex<[u8]>,
§impl LowerHex for TapTweakHash
impl LowerHex for TapTweakHash
§impl Ord for TapTweakHash
impl Ord for TapTweakHash
§impl PartialEq<TapTweakHash> for TapTweakHash
impl PartialEq<TapTweakHash> for TapTweakHash
§fn eq(&self, other: &TapTweakHash) -> bool
fn eq(&self, other: &TapTweakHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd<TapTweakHash> for TapTweakHash
impl PartialOrd<TapTweakHash> for TapTweakHash
§fn partial_cmp(&self, other: &TapTweakHash) -> Option<Ordering>
fn partial_cmp(&self, other: &TapTweakHash) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl SerdeHash for TapTweakHash
impl SerdeHash for TapTweakHash
§fn from_slice_delegated(sl: &[u8]) -> Result<TapTweakHash, Error>
fn from_slice_delegated(sl: &[u8]) -> Result<TapTweakHash, Error>
Helper function to turn a deserialized slice into the correct hash type.
§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.
§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.
§impl Serialize for TapTweakHash
impl Serialize for TapTweakHash
§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,
Serialize this value into the given Serde serializer. Read more
§impl UpperHex for TapTweakHash
impl UpperHex for TapTweakHash
impl Copy for TapTweakHash
impl Eq for TapTweakHash
impl StructuralEq for TapTweakHash
impl StructuralPartialEq for TapTweakHash
Auto Trait Implementations§
impl RefUnwindSafe for TapTweakHash
impl Send for TapTweakHash
impl Sync for TapTweakHash
impl Unpin for TapTweakHash
impl UnwindSafe for TapTweakHash
Blanket Implementations§
§impl<T> Base32Len for Twhere
T: AsRef<[u8]>,
impl<T> Base32Len for Twhere T: AsRef<[u8]>,
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
impl<T> ToBase32 for Twhere T: AsRef<[u8]>,
§fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where W: WriteBase32,
Encode as base32 and write it to the supplied writer
Implementations shouldn’t allocate.