4 stable releases

1.0.3 Nov 1, 2021
1.0.2 Apr 12, 2021
1.0.0 Jan 31, 2021
0.1.0 Mar 20, 2018

#126 in Cryptography

Download history 4103/week @ 2022-06-13 3457/week @ 2022-06-20 2829/week @ 2022-06-27 1997/week @ 2022-07-04 2910/week @ 2022-07-11 2872/week @ 2022-07-18 3555/week @ 2022-07-25 4092/week @ 2022-08-01 3864/week @ 2022-08-08 4500/week @ 2022-08-15 3893/week @ 2022-08-22 3539/week @ 2022-08-29 3218/week @ 2022-09-05 4199/week @ 2022-09-12 3253/week @ 2022-09-19 3476/week @ 2022-09-26

14,249 downloads per month
Used in 32 crates (23 directly)

MIT AND Apache-2.0

5KB

sha256 crypto digest

GitHub Actions Crates.io Docs.rs Download

Examples

sha256 digest string

use sha256::digest;

fn main() {
    let input = "hello";
    let val = digest(input);
    assert_eq!(val, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")
}

sha256 digest bytes

use sha256::digest_bytes;

fn main() {
    let input = b"hello";
    let val = digest_bytes(input);
    assert_eq!(val, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")
}

sha256 digest file

use sha256::digest_file;
use std::path::Path;

fn main() {
    let input = Path::new("./foo.file");
    let val = digest_file(input).unwrap();
    assert_eq!(val, "433855b7d2b96c23a6f60e70c655eb4305e8806b682a9596a200642f947259b1")
}

Dependencies

~375KB