[][src]Trait phollaits::HashExt

pub trait HashExt {
    pub fn md5sum(&mut self) -> Result<String>;
pub fn sha1sum(&mut self) -> Result<String>;
pub fn sha256sum(&mut self) -> Result<String>;
pub fn sha384sum(&mut self) -> Result<String>;
pub fn sha512sum(&mut self) -> Result<String>; }

This trait implements several hash-algorithms for any type which implements the io::Read-Trait.

Required methods

pub fn md5sum(&mut self) -> Result<String>[src]

this method returns the md5-digest for implemented types as a std::io::Result of String.

Example

extern crate phollaits;
use phollaits::HashExt;
use std::fs;
use std::io;
fn main() -> io::Result<()> {
	let file = fs::File::open("/home/ph0llux/Pictures/image01.png")?;
	println!("{:?}", file.md5sum());
	Ok(())
}

pub fn sha1sum(&mut self) -> Result<String>[src]

this method returns the sha1-digest for implemented types as a std::io::Result of String.

Example

extern crate phollaits;
use phollaits::HashExt;
use std::fs;
use std::io;
fn main() -> io::Result<()> {
	let file = fs::File::open("/home/ph0llux/Pictures/image01.png")?;
	println!("{:?}", file.sha1sum());
	Ok(())
}

pub fn sha256sum(&mut self) -> Result<String>[src]

this method returns the sha256-digest for implemented types as a std::io::Result of String.

Example

extern crate phollaits;
use phollaits::HashExt;
use std::fs;
use std::io;
fn main() -> io::Result<()> {
	let file = fs::File::open("/home/ph0llux/Pictures/image01.png")?;
	println!("{:?}", file.sha256sum());
	Ok(())
}

pub fn sha384sum(&mut self) -> Result<String>[src]

this method returns the sha384-digest for implemented types as a std::io::Result of String.

Example

extern crate phollaits;
use phollaits::HashExt;
use std::fs;
use std::io;
fn main() -> io::Result<()> {
	let file = fs::File::open("/home/ph0llux/Pictures/image01.png")?;
	println!("{:?}", file.sha384sum());
	Ok(())
}

pub fn sha512sum(&mut self) -> Result<String>[src]

this method returns the sha512-digest for implemented types as a std::io::Result of String.

Example

extern crate phollaits;
use phollaits::HashExt;
use std::fs;
use std::io;
fn main() -> io::Result<()> {
	let file = fs::File::open("/home/ph0llux/Pictures/image01.png")?;
	println!("{:?}", file.sha512sum());
	Ok(())
}
Loading content...

Implementations on Foreign Types

impl HashExt for dyn Read[src]

impl HashExt for File[src]

impl<R: Read> HashExt for Entry<'_, R>[src]

Loading content...

Implementors

Loading content...