Skip to content

Commit bd9fd26

Browse files
authored
md5: Add OID support (#413)
1 parent 6ba7e93 commit bd9fd26

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

.github/workflows/md5.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,20 @@ jobs:
6666
- run: cargo test --no-default-features
6767
- run: cargo test
6868
- run: cargo test --features asm
69+
70+
# TODO: merge with test on MSRV bump to 1.57 or higher
71+
test-msrv:
72+
runs-on: ubuntu-latest
73+
strategy:
74+
matrix:
75+
rust:
76+
- 1.57.0 # MSRV
77+
steps:
78+
- uses: actions/checkout@v3
79+
- uses: RustCrypto/actions/cargo-cache@master
80+
- uses: actions-rs/toolchain@v1
81+
with:
82+
profile: minimal
83+
toolchain: ${{ matrix.rust }}
84+
override: true
85+
- run: cargo test --features oid

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

md5/CHANGELOG.md

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

8+
## 0.10.5 (2022-09-32)
9+
### Added
10+
- Feature-gated OID support ([#413])
11+
12+
[#413]: https://github.com/RustCrypto/hashes/pull/413
13+
814
## 0.10.4 (2022-09-02)
915
### Fixed
1016
- MSRV issue which was not resolved by v0.10.3 ([#401])

md5/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "md-5"
3-
version = "0.10.4"
3+
version = "0.10.5"
44
description = "MD5 hash function"
55
authors = ["RustCrypto Developers"]
66
license = "MIT OR Apache-2.0"
@@ -15,16 +15,17 @@ categories = ["cryptography", "no-std"]
1515
name = "md5"
1616

1717
[dependencies]
18-
digest = "0.10.3"
18+
digest = "0.10.4"
1919

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

2323
[dev-dependencies]
24-
digest = { version = "0.10.3", features = ["dev"] }
24+
digest = { version = "0.10.4", features = ["dev"] }
2525
hex-literal = "0.2.2"
2626

2727
[features]
2828
default = ["std"]
2929
std = ["digest/std"]
3030
asm = ["md5-asm"] # WARNING: this feature SHOULD NOT be enabled by library crates
31+
oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57

md5/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ pub use digest::{self, Digest};
4141
use compress::compress;
4242

4343
use core::{fmt, slice::from_ref};
44+
#[cfg(feature = "oid")]
45+
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
4446
use digest::{
4547
block_buffer::Eager,
4648
core_api::{
@@ -124,6 +126,12 @@ impl fmt::Debug for Md5Core {
124126
}
125127
}
126128

129+
#[cfg(feature = "oid")]
130+
#[cfg_attr(docsrs, doc(cfg(feature = "oid")))]
131+
impl AssociatedOid for Md5Core {
132+
const OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.113549.2.5");
133+
}
134+
127135
/// MD5 hasher state.
128136
pub type Md5 = CoreWrapper<Md5Core>;
129137

0 commit comments

Comments
 (0)