Skip to content

Commit

Permalink
md5: Add OID support (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
lumag authored Sep 22, 2022
1 parent 6ba7e93 commit bd9fd26
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/md5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,20 @@ jobs:
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --features asm

# 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
6 changes: 3 additions & 3 deletions 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 md5/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.5 (2022-09-32)
### Added
- Feature-gated OID support ([#413])

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

## 0.10.4 (2022-09-02)
### Fixed
- MSRV issue which was not resolved by v0.10.3 ([#401])
Expand Down
7 changes: 4 additions & 3 deletions md5/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "md-5"
version = "0.10.4"
version = "0.10.5"
description = "MD5 hash function"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
Expand All @@ -15,16 +15,17 @@ categories = ["cryptography", "no-std"]
name = "md5"

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

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
md5-asm = { version = "0.5", optional = true }

[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"]
asm = ["md5-asm"] # WARNING: this feature SHOULD NOT be enabled by library crates
oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57
8 changes: 8 additions & 0 deletions md5/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub use digest::{self, Digest};
use compress::compress;

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

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

/// MD5 hasher state.
pub type Md5 = CoreWrapper<Md5Core>;

Expand Down

0 comments on commit bd9fd26

Please sign in to comment.