Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/ripemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ jobs:
strategy:
matrix:
rust:
- 1.41.0 # MSRV
# Crate supports MSRV 1.41 without `oid` feature. We test true MSRV
# in the `test-msrv` job.
- 1.57.0
- stable
steps:
- uses: actions/checkout@v3
Expand All @@ -63,3 +65,21 @@ jobs:
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --all-features

# TODO: merge with test on MSRV bump to 1.57 or higher
test-msrv:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.57.0 # MSRV
steps:
- uses: actions/checkout@v3
- uses: RustCrypto/actions/cargo-cache@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: cargo test --features oid
- run: cargo test --no-default-features
2 changes: 1 addition & 1 deletion Cargo.lock

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

6 changes: 6 additions & 0 deletions ripemd/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.1.3 (2022-09-23)
### Added
- Feature-gated OID support ([#415])

[#415]: https://github.com/RustCrypto/hashes/pull/415

## 0.1.2 (2022-09-16)
### Added
- RIPEMD-128 algorithm ([#406])
Expand Down
7 changes: 4 additions & 3 deletions ripemd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ripemd"
version = "0.1.2"
version = "0.1.3"
description = "Pure Rust implementation of the RIPEMD hash functions"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
Expand All @@ -12,12 +12,13 @@ keywords = ["crypto", "ripemd", "hash", "digest"]
categories = ["cryptography", "no-std"]

[dependencies]
digest = "0.10.3"
digest = "0.10.4"

[dev-dependencies]
digest = { version = "0.10.3", features = ["dev"] }
digest = { version = "0.10.4", features = ["dev"] }
hex-literal = "0.2.2"

[features]
default = ["std"]
std = ["digest/std"]
oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57
26 changes: 26 additions & 0 deletions ripemd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
pub use digest::{self, Digest};

use core::fmt;
#[cfg(feature = "oid")]
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
use digest::{
block_buffer::Eager,
core_api::{
Expand Down Expand Up @@ -158,3 +160,27 @@ impl_ripemd!(Ripemd128Core, Ripemd128, c128, "128", "RIPEMD-128", U16);
impl_ripemd!(Ripemd160Core, Ripemd160, c160, "160", "RIPEMD-160", U20);
impl_ripemd!(Ripemd256Core, Ripemd256, c256, "256", "RIPEMD-256", U32);
impl_ripemd!(Ripemd320Core, Ripemd320, c320, "320", "RIPEMD-320", U40);

#[cfg(feature = "oid")]
#[cfg_attr(docsrs, doc(cfg(feature = "oid")))]
impl AssociatedOid for Ripemd128Core {
/// The OID used for the RIPEMD-160. There are two OIDs defined. The Teletrust one (which is
/// used by almost anybody, including BouncyCastle, OpenSSL, GnuTLS, etc. and the ISO one
/// (1.0.10118.3.0.50), which seems to be used by nobody.
const OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.3.36.3.2.2");
}

#[cfg(feature = "oid")]
#[cfg_attr(docsrs, doc(cfg(feature = "oid")))]
impl AssociatedOid for Ripemd160Core {
/// The OID used for the RIPEMD-160. There are two OIDs defined. The Teletrust one (which is
/// used by almost anybody, including BouncyCastle, OpenSSL, GnuTLS, etc. and the ISO one
/// (1.0.10118.3.0.49), which seems to be used by Go and nobody else.
const OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.3.36.3.2.1");
}

#[cfg(feature = "oid")]
#[cfg_attr(docsrs, doc(cfg(feature = "oid")))]
impl AssociatedOid for Ripemd256Core {
const OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.3.36.3.2.3");
}