Skip to content

Commit

Permalink
md4: add OID support (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
lumag authored Oct 5, 2022
1 parent f9af45f commit 479404a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/md4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
rust:
- 1.41.0 # MSRV
- 1.57.0 # MSRV
- stable
steps:
- uses: actions/checkout@v3
Expand All @@ -63,3 +63,22 @@ 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-41:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.41.0 # MSRV
- stable
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 --no-default-features
- run: cargo test
6 changes: 6 additions & 0 deletions md4/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.10.2 (UNRELEASED)
### Added
- Feature-gated OID support ([#418])

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

## 0.10.1 (2022-02-17)
### Fixed
- Minimal versions build ([#363])
Expand Down
3 changes: 2 additions & 1 deletion md4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ categories = ["cryptography", "no-std"]
digest = "0.10.3"

[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
8 changes: 8 additions & 0 deletions md4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
pub use digest::{self, Digest};

use core::{convert::TryInto, fmt};
#[cfg(feature = "oid")]
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
use digest::{
block_buffer::Eager,
core_api::{
Expand Down Expand Up @@ -122,6 +124,12 @@ impl fmt::Debug for Md4Core {
}
}

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

/// MD4 hasher state.
pub type Md4 = CoreWrapper<Md4Core>;

Expand Down

0 comments on commit 479404a

Please sign in to comment.