Skip to content

Commit

Permalink
Added dependency shim for old sha1 crate (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jan 16, 2022
1 parent eb94a91 commit d26382e
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions legacy-shim/.gitignore
@@ -0,0 +1,2 @@
/target
/Cargo.lock
25 changes: 25 additions & 0 deletions legacy-shim/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions legacy-shim/Cargo.toml
@@ -0,0 +1,19 @@
[package]
name = "sha1"
version = "0.6.1"
authors = ["Armin Ronacher <armin.ronacher@active-4.com>"]
keywords = ["sha1"]
description = "Minimal dependency free implementation of SHA1 for Rust."
license = "BSD-3-Clause"
repository = "https://github.com/mitsuhiko/sha1-smol"
edition = "2018"

[features]
std = ["sha1_smol/std"]
serde = ["sha1_smol/serde"]

[dependencies]
sha1_smol = "1.0.0"

[package.metadata.docs.rs]
all-features = true
1 change: 1 addition & 0 deletions legacy-shim/LICENSE
1 change: 1 addition & 0 deletions legacy-shim/README.md
38 changes: 38 additions & 0 deletions legacy-shim/src/lib.rs
@@ -0,0 +1,38 @@
//! 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.
//!
//! **Note:** future versions of this crate with the old code are now under
//! `sha1_smol`, the `sha1` crate name with versions beyond the 0.6 line now
//! refer to the `RustCrypto` implementation.
//!
//! ## Example
//!
//! ```rust
//! # fn main() {
//!
//! let mut m = sha1_smol::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 (requires std):
//!
//! ```
//! # trait X { fn hexdigest(&self) -> &'static str { "2ef7bde608ce5404e97d5f042f95f89f1c232871" }}
//! # impl X for sha1_smol::Sha1 {}
//! # fn main() {
//! assert_eq!(sha1_smol::Sha1::from("Hello World!").hexdigest(),
//! "2ef7bde608ce5404e97d5f042f95f89f1c232871");
//! # }
//! ```

pub use sha1_smol::*;

0 comments on commit d26382e

Please sign in to comment.