From d26382eac31ebd48dfdbf915a9aa734e78cd1517 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 16 Jan 2022 09:54:14 +0100 Subject: [PATCH] Added dependency shim for old sha1 crate (#41) --- legacy-shim/.gitignore | 2 ++ legacy-shim/Cargo.lock | 25 +++++++++++++++++++++++++ legacy-shim/Cargo.toml | 19 +++++++++++++++++++ legacy-shim/LICENSE | 1 + legacy-shim/README.md | 1 + legacy-shim/src/lib.rs | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 86 insertions(+) create mode 100644 legacy-shim/.gitignore create mode 100644 legacy-shim/Cargo.lock create mode 100644 legacy-shim/Cargo.toml create mode 120000 legacy-shim/LICENSE create mode 120000 legacy-shim/README.md create mode 100644 legacy-shim/src/lib.rs diff --git a/legacy-shim/.gitignore b/legacy-shim/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/legacy-shim/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/legacy-shim/Cargo.lock b/legacy-shim/Cargo.lock new file mode 100644 index 0000000..3a10466 --- /dev/null +++ b/legacy-shim/Cargo.lock @@ -0,0 +1,25 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "serde" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" + +[[package]] +name = "sha1" +version = "0.6.1" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +dependencies = [ + "serde", +] diff --git a/legacy-shim/Cargo.toml b/legacy-shim/Cargo.toml new file mode 100644 index 0000000..edb2c3b --- /dev/null +++ b/legacy-shim/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "sha1" +version = "0.6.1" +authors = ["Armin Ronacher "] +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 diff --git a/legacy-shim/LICENSE b/legacy-shim/LICENSE new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/legacy-shim/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/legacy-shim/README.md b/legacy-shim/README.md new file mode 120000 index 0000000..32d46ee --- /dev/null +++ b/legacy-shim/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/legacy-shim/src/lib.rs b/legacy-shim/src/lib.rs new file mode 100644 index 0000000..974d484 --- /dev/null +++ b/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::*;