#[repr(C)]pub struct Hash(pub [u8; 32]);Expand description
A sha256 hash digest. The standard hash in the scuttleverse.
Tuple Fields§
§0: [u8; 32]Implementations§
Source§impl Hash
impl Hash
Sourcepub fn from_slice(s: &[u8]) -> Option<Self>
pub fn from_slice(s: &[u8]) -> Option<Self>
Deserialize from byte representation.
Returns None if the slice length isn’t 32.
Note that this doesn’t hash the provided byte slice,
use the hash function for that.
Sourcepub fn from_base64(s: &str) -> Option<Self>
pub fn from_base64(s: &str) -> Option<Self>
Deserialize from base-64 string representation. Ignores optional leading ‘%’ or ‘&’ sigil and ‘.sha256’ suffix.
§Example
let s = "%4hUgS4j0TwKdsZzOV/tfqiPtqoLw2qYg/Wl9Xy8FPEU=.sha256";
let h = ssb_crypto::Hash::from_base64(s).unwrap();Trait Implementations§
impl FromBytes for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
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