Skip to content

Commit

Permalink
md2: add OID support (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
lumag authored Oct 5, 2022
1 parent 479404a commit e07cc2d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/md2.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 md2/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 ([#419])

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

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

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

[dev-dependencies]
digest = { version = "0.10.3", features = ["dev"] }
Expand All @@ -21,3 +21,4 @@ hex-literal = "0.2.2"
[features]
default = ["std"]
std = ["digest/std"]
oid = ["digest/oid"]
8 changes: 8 additions & 0 deletions md2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
pub use digest::{self, Digest};

use core::fmt;
#[cfg(feature = "oid")]
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
use digest::{
block_buffer::Eager,
consts::U16,
Expand Down Expand Up @@ -146,5 +148,11 @@ impl fmt::Debug for Md2Core {
}
}

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

/// MD2 hasher state.
pub type Md2 = CoreWrapper<Md2Core>;

0 comments on commit e07cc2d

Please sign in to comment.