#sha1

sha1

Minimal implementation of SHA1 for Rust

14 releases (6 breaking)

0.6.0 Feb 11, 2018
0.4.0 Dec 30, 2017
0.2.0 Jul 13, 2016
0.1.1 Apr 26, 2015
0.0.3 Nov 21, 2014

#2 in #sha1

Download history 36179/week @ 2019-12-17 21925/week @ 2019-12-24 27062/week @ 2019-12-31 40453/week @ 2020-01-07 39651/week @ 2020-01-14 39330/week @ 2020-01-21 42896/week @ 2020-01-28 49073/week @ 2020-02-04 44529/week @ 2020-02-11 45107/week @ 2020-02-18 44777/week @ 2020-02-25 46289/week @ 2020-03-03 43979/week @ 2020-03-10 45545/week @ 2020-03-17 44666/week @ 2020-03-24 42427/week @ 2020-03-31

161,130 downloads per month
Used in 894 crates (81 directly)

BSD-3-Clause

29KB
684 lines

rust-sha1

Minimal implementation of SHA1 for Rust.

Right now SHA1 is quite frequently used and many things want to have an implementation of it, that does not pull in too much other stuff.

This is largely based on the hash code in crypto-rs by Koka El Kiwi.


lib.rs:

A minimal implementation of SHA1 for rust.

This implementation supports no_std which is the default mode. The following features are available and can be optionally enabled:

  • serde: when enabled the Digest type can be serialized.
  • std: when enabled errors from this library implement std::error::Error and the hexdigest shortcut becomes available.

Simple Example:

extern crate sha1;
# fn main() {

let mut m = sha1::Sha1::new();
m.update(b"Hello World!");
assert_eq!(m.digest().to_string(),
           "2ef7bde608ce5404e97d5f042f95f89f1c232871");
# }

The sha1 object can be updated multiple times. If you only need to use it once you can also use shortcuts:

extern crate sha1;
# fn main() {
assert_eq!(sha1::Sha1::from("Hello World!").hexdigest(),
           "2ef7bde608ce5404e97d5f042f95f89f1c232871");
# }

Dependencies

~73KB