pub struct Diger { /* private fields */ }
Expand description
use cesride::{matter, Matter, Diger};
use std::error::Error;
// here we simply print a qualified digest in base64 to stdout after hashing serialized data
// hash digests underpin core concepts of the KERI ecosystem/
fn example() -> Result<(), Box<dyn Error>> {
let data = b"abcdefg";
// derive the digest, opting this time to specify the algorithm
let diger = Diger::new_with_ser(data, Some(matter::Codex::SHA3_512))?;
// output the digest
println!("Blake3 256 digest: #{d}", d=diger.qb64()?);
Ok(())
}
example().unwrap();
Implementations§
Source§impl Diger
impl Diger
pub fn new( ser: Option<&[u8]>, code: Option<&str>, raw: Option<&[u8]>, qb64b: Option<&[u8]>, qb64: Option<&str>, qb2: Option<&[u8]>, ) -> Result<Self>
pub fn new_with_ser(ser: &[u8], code: Option<&str>) -> Result<Self>
pub fn new_with_raw(raw: &[u8], code: Option<&str>) -> Result<Self>
pub fn new_with_qb64b(qb64b: &[u8]) -> Result<Self>
pub fn new_with_qb64(qb64: &str) -> Result<Self>
pub fn new_with_qb2(qb2: &[u8]) -> Result<Self>
pub fn verify(&self, ser: &[u8]) -> Result<bool>
pub fn compare( &self, ser: &[u8], dig: Option<&[u8]>, diger: Option<&Diger>, ) -> Result<bool>
Trait Implementations§
Source§impl Matter for Diger
impl Matter for Diger
fn code(&self) -> String
fn raw(&self) -> Vec<u8> ⓘ
fn size(&self) -> u32
fn set_code(&mut self, code: &str)
fn set_raw(&mut self, raw: &[u8])
fn set_size(&mut self, size: u32)
fn new( code: Option<&str>, raw: Option<&[u8]>, qb64b: Option<&[u8]>, qb64: Option<&str>, qb2: Option<&[u8]>, ) -> Result<Self>
fn new_with_code_and_raw(code: &str, raw: &[u8]) -> Result<Self>where
Self: Sized,
fn new_with_qb64(qb64: &str) -> Result<Self>where
Self: Sized,
fn new_with_qb64b(qb64b: &[u8]) -> Result<Self>where
Self: Sized,
fn new_with_qb2(qb2: &[u8]) -> Result<Self>where
Self: Sized,
fn qb64(&self) -> Result<String>
fn qb64b(&self) -> Result<Vec<u8>>
fn qb2(&self) -> Result<Vec<u8>>
fn digestive(&self) -> bool
fn transferable(&self) -> bool
fn infil(&self) -> Result<String>
fn binfil(&self) -> Result<Vec<u8>>
fn exfil(&mut self, qb64: &str) -> Result<()>
fn bexfil(&mut self, qb2: &[u8]) -> Result<()>
fn full_size(&self) -> Result<usize>
impl StructuralPartialEq for Diger
Auto Trait Implementations§
impl Freeze for Diger
impl RefUnwindSafe for Diger
impl Send for Diger
impl Sync for Diger
impl Unpin for Diger
impl UnwindSafe for Diger
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