[−][src]Struct grin_core::core::hash::Hash
A hash to uniquely (or close enough) identify one of the main blockchain constructs. Used pervasively for blocks, transactions and outputs.
Implementations
impl Hash
[src]
pub const LEN: usize
[src]
A hash is 32 bytes.
pub fn from_vec(v: &[u8]) -> Hash
[src]
Builds a Hash from a byte vector. If the vector is too short, it will be completed by zeroes. If it's too long, it will be truncated.
pub fn to_vec(&self) -> Vec<u8>
[src]
Converts the hash to a byte vector
pub fn as_bytes(&self) -> &[u8]
[src]
Returns a byte slice of the hash contents.
pub fn from_hex(hex: &str) -> Result<Hash, Error>
[src]
Convert hex string back to hash.
pub fn to_u64(&self) -> u64
[src]
Most significant 64 bits
Trait Implementations
impl AsRef<[u8]> for Hash
[src]
impl Clone for Hash
[src]
impl Copy for Hash
[src]
impl Debug for Hash
[src]
impl Default for Hash
[src]
impl DefaultHashable for Hash
[src]
impl<'de> Deserialize<'de> for Hash
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Hash
[src]
impl Eq for Hash
[src]
impl Hash for Hash
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<Range<usize>> for Hash
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: Range<usize>) -> &[u8]
[src]
impl Index<RangeFrom<usize>> for Hash
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: RangeFrom<usize>) -> &[u8]
[src]
impl Index<RangeFull> for Hash
[src]
impl Index<RangeTo<usize>> for Hash
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: RangeTo<usize>) -> &[u8]
[src]
impl Index<usize> for Hash
[src]
impl Ord for Hash
[src]
fn cmp(&self, other: &Hash) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Hash> for Hash
[src]
impl PartialOrd<Hash> for Hash
[src]
fn partial_cmp(&self, other: &Hash) -> Option<Ordering>
[src]
fn lt(&self, other: &Hash) -> bool
[src]
fn le(&self, other: &Hash) -> bool
[src]
fn gt(&self, other: &Hash) -> bool
[src]
fn ge(&self, other: &Hash) -> bool
[src]
impl Readable for Hash
[src]
impl Serialize for Hash
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Hash
[src]
impl StructuralPartialEq for Hash
[src]
impl Writeable for Hash
[src]
Auto Trait Implementations
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
T: Send + Sync,
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<D> Hashed for D where
D: DefaultHashable,
[src]
D: DefaultHashable,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> PMMRIndexHashable for T where
T: DefaultHashable,
[src]
T: DefaultHashable,
fn hash_with_index(&Self, u64) -> Hash
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<H> ShortIdentifiable for H where
H: Hashed,
[src]
H: Hashed,
fn short_id(&Self, &Hash, u64) -> ShortId
[src]
Generate a short_id via the following -
- extract k0/k1 from block_hash hashed with the nonce (first two u64
values) * initialize a siphasher24 with k0/k1
- self.hash() passing in the siphasher24 instance
- drop the 2 most significant bytes (to return a 6 byte short_id)
impl<T> ToHex for T where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> UnsafeAny for T where
T: Any,
T: Any,