Skip to content

Commit c46466f

Browse files
authored
sha3: move cSHAKE and TurboSHAKE into separate crates (#815)
1 parent b5051e5 commit c46466f

35 files changed

Lines changed: 1549 additions & 455 deletions

.github/workflows/cshake.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: cshake
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/cshake.yml"
7+
- "cshake/**"
8+
- "Cargo.*"
9+
push:
10+
branches: master
11+
12+
defaults:
13+
run:
14+
working-directory: cshake
15+
16+
env:
17+
CARGO_INCREMENTAL: 0
18+
RUSTFLAGS: "-Dwarnings"
19+
20+
# Cancels CI jobs when new commits are pushed to a PR branch
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
set-msrv:
27+
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
28+
with:
29+
msrv: 1.85.0
30+
31+
build:
32+
needs: set-msrv
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
rust:
37+
- ${{needs.set-msrv.outputs.msrv}}
38+
- stable
39+
target:
40+
- thumbv7em-none-eabi
41+
- wasm32-unknown-unknown
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: RustCrypto/actions/cargo-cache@master
45+
- uses: dtolnay/rust-toolchain@master
46+
with:
47+
toolchain: ${{ matrix.rust }}
48+
targets: ${{ matrix.target }}
49+
- uses: RustCrypto/actions/cargo-hack-install@master
50+
- run: cargo hack build --target ${{ matrix.target }} --each-feature
51+
52+
test:
53+
needs: set-msrv
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
rust:
58+
- ${{needs.set-msrv.outputs.msrv}}
59+
- stable
60+
steps:
61+
- uses: actions/checkout@v6
62+
- uses: RustCrypto/actions/cargo-cache@master
63+
- uses: dtolnay/rust-toolchain@master
64+
with:
65+
toolchain: ${{ matrix.rust }}
66+
- uses: RustCrypto/actions/cargo-hack-install@master
67+
- run: cargo hack test --feature-powerset
68+
69+
minimal-versions:
70+
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
71+
with:
72+
working-directory: ${{ github.workflow }}

.github/workflows/turbo-shake.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: turbo-shake
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/turbo-shake.yml"
7+
- "turbo-shake/**"
8+
- "Cargo.*"
9+
push:
10+
branches: master
11+
12+
defaults:
13+
run:
14+
working-directory: turbo-shake
15+
16+
env:
17+
CARGO_INCREMENTAL: 0
18+
RUSTFLAGS: "-Dwarnings"
19+
20+
# Cancels CI jobs when new commits are pushed to a PR branch
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
set-msrv:
27+
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
28+
with:
29+
msrv: 1.85.0
30+
31+
build:
32+
needs: set-msrv
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
rust:
37+
- ${{needs.set-msrv.outputs.msrv}}
38+
- stable
39+
target:
40+
- thumbv7em-none-eabi
41+
- wasm32-unknown-unknown
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: RustCrypto/actions/cargo-cache@master
45+
- uses: dtolnay/rust-toolchain@master
46+
with:
47+
toolchain: ${{ matrix.rust }}
48+
targets: ${{ matrix.target }}
49+
- uses: RustCrypto/actions/cargo-hack-install@master
50+
- run: cargo hack build --target ${{ matrix.target }} --each-feature
51+
52+
test:
53+
needs: set-msrv
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
rust:
58+
- ${{needs.set-msrv.outputs.msrv}}
59+
- stable
60+
steps:
61+
- uses: actions/checkout@v6
62+
- uses: RustCrypto/actions/cargo-cache@master
63+
- uses: dtolnay/rust-toolchain@master
64+
with:
65+
toolchain: ${{ matrix.rust }}
66+
- uses: RustCrypto/actions/cargo-hack-install@master
67+
- run: cargo hack test --feature-powerset
68+
69+
minimal-versions:
70+
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
71+
with:
72+
working-directory: ${{ github.workflow }}

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ members = [
55
"bash-hash",
66
"belt-hash",
77
"blake2",
8+
"cshake",
89
"fsb",
910
"gost94",
1011
"groestl",
@@ -24,6 +25,7 @@ members = [
2425
"sm3",
2526
"streebog",
2627
"tiger",
28+
"turbo-shake",
2729
"whirlpool",
2830
]
2931

@@ -32,5 +34,5 @@ opt-level = 2
3234

3335
[patch.crates-io]
3436
sha1 = { path = "sha1" }
35-
sha3 = { path = "sha3" }
37+
turbo-shake = { path = "turbo-shake" }
3638
whirlpool = { path = "whirlpool" }

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ easily used for bare-metal or WebAssembly programming by disabling default crate
2121
| [Bash] hash | [`bash‑hash`] | [![crates.io](https://img.shields.io/crates/v/bash-hash.svg)](https://crates.io/crates/bash-hash) | [![Documentation](https://docs.rs/bash-hash/badge.svg)](https://docs.rs/bash-hash) | 1.85 | :green_heart: |
2222
| [BelT] hash | [`belt‑hash`] | [![crates.io](https://img.shields.io/crates/v/belt-hash.svg)](https://crates.io/crates/belt-hash) | [![Documentation](https://docs.rs/belt-hash/badge.svg)](https://docs.rs/belt-hash) | 1.85 | :green_heart: |
2323
| [BLAKE2] | [`blake2`] | [![crates.io](https://img.shields.io/crates/v/blake2.svg)](https://crates.io/crates/blake2) | [![Documentation](https://docs.rs/blake2/badge.svg)](https://docs.rs/blake2) | 1.85 | :green_heart: |
24+
| [cSHAKE] | [`cshake`] | [![crates.io](https://img.shields.io/crates/v/cshake.svg)](https://crates.io/crates/cshake) | [![Documentation](https://docs.rs/cshake/badge.svg)](https://docs.rs/cshake) | 1.85 | :green_heart: |
2425
| [FSB] | [`fsb`] | [![crates.io](https://img.shields.io/crates/v/fsb.svg)](https://crates.io/crates/fsb) | [![Documentation](https://docs.rs/fsb/badge.svg)](https://docs.rs/fsb) | 1.85 | :green_heart: |
2526
| [GOST R 34.11-94][GOST94] | [`gost94`] | [![crates.io](https://img.shields.io/crates/v/gost94.svg)](https://crates.io/crates/gost94) | [![Documentation](https://docs.rs/gost94/badge.svg)](https://docs.rs/gost94) | 1.85 | :yellow_heart: |
2627
| [Grøstl] (Groestl) | [`groestl`] | [![crates.io](https://img.shields.io/crates/v/groestl.svg)](https://crates.io/crates/groestl) | [![Documentation](https://docs.rs/groestl/badge.svg)](https://docs.rs/groestl) | 1.85 | :green_heart: |
@@ -40,6 +41,7 @@ easily used for bare-metal or WebAssembly programming by disabling default crate
4041
| [SM3] (OSCCA GM/T 0004-2012) | [`sm3`] | [![crates.io](https://img.shields.io/crates/v/sm3.svg)](https://crates.io/crates/sm3) | [![Documentation](https://docs.rs/sm3/badge.svg)](https://docs.rs/sm3) | 1.85 | :green_heart: |
4142
| [Streebog] (GOST R 34.11-2012) | [`streebog`] | [![crates.io](https://img.shields.io/crates/v/streebog.svg)](https://crates.io/crates/streebog) | [![Documentation](https://docs.rs/streebog/badge.svg)](https://docs.rs/streebog) | 1.85 | :yellow_heart: |
4243
| [Tiger] | [`tiger`] | [![crates.io](https://img.shields.io/crates/v/tiger.svg)](https://crates.io/crates/tiger) | [![Documentation](https://docs.rs/tiger/badge.svg)](https://docs.rs/tiger) | 1.85 | :green_heart: |
44+
| [TurboSHAKE] | [`turbo-shake`] | [![crates.io](https://img.shields.io/crates/v/turbo-shake.svg)](https://crates.io/crates/turbo-shake) | [![Documentation](https://docs.rs/turbo-shake/badge.svg)](https://docs.rs/turbo-shake) | 1.85 | :green_heart: |
4345
| [Whirlpool] | [`whirlpool`] | [![crates.io](https://img.shields.io/crates/v/whirlpool.svg)](https://crates.io/crates/whirlpool) | [![Documentation](https://docs.rs/whirlpool/badge.svg)](https://docs.rs/whirlpool) | 1.85 | :green_heart: |
4446

4547
NOTE: the [`blake3`] crate implements the `digest` traits used by the rest of the hashes in this repository, but is maintained by the BLAKE3 team.
@@ -94,6 +96,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
9496
[`bash‑hash`]: ./bash-hash
9597
[`belt‑hash`]: ./belt-hash
9698
[`blake2`]: ./blake2
99+
[`cshake`]: ./cshake
97100
[`fsb`]: ./fsb
98101
[`gost94`]: ./gost94
99102
[`groestl`]: ./groestl
@@ -113,6 +116,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
113116
[`sm3`]: ./sm3
114117
[`streebog`]: ./streebog
115118
[`tiger`]: ./tiger
119+
[`turbo-shake`]: ./turbo-shake
116120
[`whirlpool`]: ./whirlpool
117121

118122
[//]: # (footnotes)
@@ -138,6 +142,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
138142
[Bash]: https://apmi.bsu.by/assets/files/std/bash-spec241.pdf
139143
[BelT]: https://ru.wikipedia.org/wiki/BelT
140144
[BLAKE2]: https://en.wikipedia.org/wiki/BLAKE_(hash_function)#BLAKE2
145+
[cSHAKE]: https://csrc.nist.gov/pubs/sp/800/185/final
141146
[FSB]: https://en.wikipedia.org/wiki/Fast_syndrome-based_hash
142147
[GOST94]: https://en.wikipedia.org/wiki/GOST_(hash_function)
143148
[Grøstl]: https://en.wikipedia.org/wiki/Grøstl
@@ -158,3 +163,4 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
158163
[Streebog]: https://en.wikipedia.org/wiki/Streebog
159164
[Whirlpool]: https://en.wikipedia.org/wiki/Whirlpool_(cryptography)
160165
[Tiger]: http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger/tiger.html
166+
[TurboSHAKE]: https://keccak.team/turboshake.html

cshake/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## 0.1.0 (UNRELEASED)
9+
- Initial release with implementation moved from the `sha3` crate ([#815])
10+
11+
[#815]: https://github.com/RustCrypto/hashes/pull/815

cshake/Cargo.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[package]
2+
name = "cshake"
3+
version = "0.1.0"
4+
authors = ["RustCrypto Developers"]
5+
edition = "2024"
6+
rust-version = "1.85"
7+
documentation = "https://docs.rs/sha3"
8+
readme = "README.md"
9+
repository = "https://github.com/RustCrypto/hashes"
10+
license = "MIT OR Apache-2.0"
11+
keywords = ["sha3", "keccak", "hash", "xof", "digest"]
12+
categories = ["cryptography", "no-std"]
13+
description = "Implementation of the cSHAKE family of extendable-output functions (XOFs)"
14+
15+
[dependencies]
16+
digest = "0.11"
17+
keccak = "0.2"
18+
19+
[dev-dependencies]
20+
digest = { version = "0.11", features = ["dev"] }
21+
hex-literal = "1"
22+
23+
[features]
24+
default = ["alloc", "oid"]
25+
alloc = ["digest/alloc"]
26+
oid = ["digest/oid"] # Enable OID support.
27+
zeroize = ["digest/zeroize"]
28+
29+
[package.metadata.docs.rs]
30+
all-features = true

0 commit comments

Comments
 (0)