[−][src]Struct b2sum_rust::Blake2bSum
Blake2b File Hash Constructor
This is the official constructor used to call the new() function with the parameter of the intended digest size.
Example
use b2sum_rust::Blake2bSum; fn main(){ // Creates a new File Instance let context = Blake2bSum::new(64); // Outputs a Hexadecimal String let hash = context.read("example_file.txt"); // Converts the hexadecimal string to a vector of bytes let _bytes = Blake2bSum::to_bytes(&hash); // Prints The Hexadecimal Representation println!("Hash: {}",hash); // Asserts That These Are Equal assert_eq!(hash,"33B20D15383F97EB46D4FA69442596170CCA01008963A7D0E47210C33AEEF991C78323850C012550C227954A40B3D7AD612568ABC73DB9233FAB9EA4F002B0CB"); }
Methods
impl Blake2bSum
[src]
pub fn new(digest: usize) -> Self
[src]
pub fn read<T: AsRef<Path>>(&self, path: T) -> String
[src]
Hash File
This is a function that hashes a file using Blake2b and returns the Hexadecimal Representation of it as a String. It takes as input any reference to Path.
It should be noted that changes to the file during hashing, such as truncating the file can cause problems.
pub fn to_bytes(s: &str) -> Vec<u8>
[src]
Trait Implementations
Auto Trait Implementations
impl Send for Blake2bSum
impl Sync for Blake2bSum
impl Unpin for Blake2bSum
impl UnwindSafe for Blake2bSum
impl RefUnwindSafe for Blake2bSum
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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> 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,