Skip to content

implementation of md6 in pure rust #636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
71 changes: 71 additions & 0 deletions .github/workflows/md6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: md6

on:
pull_request:
paths:
- ".github/workflows/md6.yml"
- "md6/**"
- "Cargo.*"
push:
branches: master
paths:
- "md6/**"
- "Cargo.*"

defaults:
run:
working-directory: md6

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"

jobs:
set-msrv:
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
with:
msrv: 1.85.0

build:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
- loongarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cargo-hack-install@master
- run: cargo hack build --target ${{ matrix.target }} --each-feature --exclude-features default,std

test:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: RustCrypto/actions/cargo-hack-install@master
- run: cargo hack test --feature-powerset

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
56 changes: 31 additions & 25 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Additionally all crates do not require the standard library (i.e. `no_std` capab
| [MD2] | [`md2`] | [![crates.io](https://img.shields.io/crates/v/md2.svg)](https://crates.io/crates/md2) | [![Documentation](https://docs.rs/md2/badge.svg)](https://docs.rs/md2) | 1.85 | :broken_heart: |
| [MD4] | [`md4`] | [![crates.io](https://img.shields.io/crates/v/md4.svg)](https://crates.io/crates/md4) | [![Documentation](https://docs.rs/md4/badge.svg)](https://docs.rs/md4) | 1.85 | :broken_heart: |
| [MD5] | [`md5`] [:exclamation:] | [![crates.io](https://img.shields.io/crates/v/md-5.svg)](https://crates.io/crates/md-5) | [![Documentation](https://docs.rs/md-5/badge.svg)](https://docs.rs/md-5) | 1.85 | :broken_heart: |
| [MD6] | [`md6`] | [![crates.io](https://img.shields.io/crates/v/md-6.svg)](https://crates.io/crates/md-6) | [![Documentation](https://docs.rs/md-6/badge.svg)](https://docs.rs/md-6) | 1.85 | :green_heart: |
| [RIPEMD] | [`ripemd`] | [![crates.io](https://img.shields.io/crates/v/ripemd.svg)](https://crates.io/crates/ripemd) | [![Documentation](https://docs.rs/ripemd/badge.svg)](https://docs.rs/ripemd) | 1.85 | :green_heart: |
| [SHA-1] | [`sha1`] | [![crates.io](https://img.shields.io/crates/v/sha1.svg)](https://crates.io/crates/sha1) | [![Documentation](https://docs.rs/sha1/badge.svg)](https://docs.rs/sha1) | 1.85 | :broken_heart: |
| [SHA-1 Checked] | [`sha1-checked`] | [![crates.io](https://img.shields.io/crates/v/sha1-checked.svg)](https://crates.io/crates/sha1-checked) | [![Documentation](https://docs.rs/sha1-checked/badge.svg)](https://docs.rs/sha1-checked) | 1.85 | :yellow_heart: |
Expand Down Expand Up @@ -246,6 +247,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
[`md2`]: ./md2
[`md4`]: ./md4
[`md5`]: ./md5
[`md6`]: ./md6
[`ripemd`]: ./ripemd
[`sha1`]: ./sha1
[`sha1-checked`]: ./sha1-checked
Expand Down Expand Up @@ -289,6 +291,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
[MD2]: https://en.wikipedia.org/wiki/MD2_(cryptography)
[MD4]: https://en.wikipedia.org/wiki/MD4
[MD5]: https://en.wikipedia.org/wiki/MD5
[MD6]: https://en.wikipedia.org/wiki/MD6
[RIPEMD]: https://en.wikipedia.org/wiki/RIPEMD
[SHA-1]: https://en.wikipedia.org/wiki/SHA-1
[SHA-1 Checked]: https://github.com/cr-marcstevens/sha1collisiondetection
Expand Down
14 changes: 9 additions & 5 deletions md6/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[package]
name = "md6"
version = "0.1.0"
version = "0.11.0-pre.5"
description = "MD6 hash function"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2021"
edition = "2024"
rust-version = "1.85"
repository = "https://github.com/RustCrypto/hashes"
keywords = ["crypto", "md6", "hash", "digest"]
categories = ["cryptography", "no-std"]
rust-version = "1.81"

[dependencies]
digest = "=0.11.0-pre.9"
digest = "=0.11.0-pre.10"

[dev-dependencies]
digest = { version = "=0.11.0-pre.9", features = ["dev"] }
digest = { version = "=0.11.0-pre.10", features = ["dev"] }
hex-literal = "0.4"
base16ct = { version = "0.2", features = ["alloc"] }

Expand All @@ -24,3 +24,7 @@ default = ["oid", "std"]
std = ["digest/std"]
oid = ["digest/oid"]
zeroize = ["digest/zeroize"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
8 changes: 3 additions & 5 deletions md6/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// MD6 constants related to standard mode of operation

pub type Md6Word = u64;
pub type Md6ControlWord = u64;
pub type Md6NodeID = u64;
Expand All @@ -18,10 +17,9 @@ pub const MD6_C: usize = 16;
/// Size of compression input block in words
pub const MD6_N: usize = 89;

// These five values give lengths of the components of compression
// input block; they should sum to MD6_N.

// Q words in a compression block (>= 0)
/// These five values give lengths of the components of compression
/// input block; they should sum to MD6_N.
/// Q words in a compression block (>= 0)
pub const MD6_Q: usize = 15;
/// Key words per compression block (>= 0)
pub const MD6_K: usize = 8;
Expand Down
Loading
Loading