agureev
3a56e99771
chore: remove unstable zkvm flag
2026-06-25 14:00:08 +04:00
agureev
16ac194828
feat: use Risc0 backend in keccak implementation
2026-06-23 16:26:06 +04:00
agureev
f39cc8b2a3
chore: expose Risc0 backend
2026-06-23 16:26:00 +04:00
agureev
ff608af82a
feat: add a Risc0 backend
...
Defaults to software keccak on unoptimized rounds
2026-06-23 16:25:53 +04:00
agureev
c4b35a1346
chore: add Risc0 zkVM dependency
2026-06-23 16:25:41 +04:00
Artyom Pavlov
8b2c41b0d2
Release keccak v0.2.0 ( #117 )
...
### Added
- `keccak_backend` configuration parameter with `aarch64_sha3`,
`simd128`,
`simd256`, `simd512`, and `soft` values ([#105 ], [#106 ], [#113 ])
- `Keccak` struct with a closure-based API for a more efficient access
to
supported backends ([#113 ])
### Changed
- Edition changed to 2024 and MSRV bumped to 1.85 ([#89 ])
- Bump `cpufeatures` dependency to v0.3 ([#99 ])
- AArch64 ASM backend is re-implemented using intrinsics (note that it's
still
enabled by default on AArch64 targets behind target feature
auto-detection) ([#112 ])
### Removed
- `asm`, `simd`, and `no_unroll` crate features in favor of
`keccak_backend`
and `keccak_backend_soft` configuration parameters ([#105 ], [#106 ],
[#113 ])
- `f1600` and `p1600` functions in favor of the `Keccak` struct ([#113 ])
### Fixed
- Use `doc_cfg` in place of removed `doc_auto_cfg` feature ([#91 ])
[#89 ]: https://github.com/RustCrypto/sponges/pull/89
[#91 ]: https://github.com/RustCrypto/sponges/pull/91
[#99 ]: https://github.com/RustCrypto/sponges/pull/99
[#105 ]: https://github.com/RustCrypto/sponges/pull/105
[#106 ]: https://github.com/RustCrypto/sponges/pull/106
[#112 ]: https://github.com/RustCrypto/sponges/pull/112
[#113 ]: https://github.com/RustCrypto/sponges/pull/113
2026-03-16 03:24:48 +03:00
Artyom Pavlov
609b63ecbf
keccak: replace keccak_soft_compact with keccak_backend_soft="compact" ( #116 )
...
This would allow to extend configuration knobs for the software backend
in future and would be more consisted with potential similar knobs for
other backends.
2026-03-16 00:00:06 +03:00
Artyom Pavlov
d96c7f3733
Use the standard order of [package] fields ( #115 )
...
See https://github.com/RustCrypto/meta/issues/22
2026-03-12 04:17:45 +03:00
Artyom Pavlov
1efeff7d02
keccak: refactor to a closure-based API ( #113 )
...
The new API provides a better way for exposing support for parallel
processing in implemented backends and resolves the issue with branching
on each application of a Keccak permutation.
2026-03-06 16:07:46 +03:00
Tony Arcieri
806d446c41
keccak: convert ARMv8 ASM into intrinsics ( #112 )
...
Rewrites the inline assembly implementation using an equivalent (but not
identical) intrinsics implementation. Also exposes support for computing
two Keccak states in parallel which a previous comment in the ASM
implementation noted was possible but wasn't actually exposed, and is
now available as `p1600_armv8_sha3_times2` (though not yet in the public
API, see #110 ).
This is a little tricky due to high register pressure: this
implementation uses every vector register.
I started by rewriting the round loop and iterating over the round
constants, then breaking apart the body into theta and everything else
(rho/pi/chi/iota), mapping the NEON registers onto a `[uint64x2_t; 25]`
state.
Theta was translated by hand, but the rest of them were too tedious
regarding a manual mapping of the registers to slots in the state array.
So I wrote a small program that operates over a representation of the
original assembly, doing all the bookkeeping for which registers map to
which slots in the state array, and outputs the equivalent intrinsics
code.
Godbolt links to the original `asm!` versus this translation:
- original: https://godbolt.org/z/G8Mf5vboE
- translated: https://godbolt.org/z/sszzbdexK
It's using nearly the same number of instructions, but there are
differences between the two versions, i.e. it isn't an identical
recreation of the original assembly, which I'm not sure is
possible/preferable, but it should be functionally equivalent.
Since we're no longer using `asm!`, `cfg(armv8_asm)` has been removed
and this is now enabled by default on `aarch64` targets.
Closes #95
# Benchmarks (`sha3` crate on M1 Max)
## Pure software implementation
test sha3_224_10 ... bench: 17.97 ns/iter (+/- 0.32) = 588 MB/s
test sha3_224_100 ... bench: 164.15 ns/iter (+/- 5.14) = 609 MB/s
test sha3_224_1000 ... bench: 1,646.07 ns/iter (+/- 139.45) = 607 MB/s
test sha3_224_10000 ... bench: 16,585.52 ns/iter (+/- 1,168.57) = 602 MB/s
test sha3_256_10 ... bench: 19.12 ns/iter (+/- 0.77) = 526 MB/s
test sha3_256_1000 ... bench: 1,694.21 ns/iter (+/- 41.20) = 590 MB/s
test sha3_256_10000 ... bench: 16,807.40 ns/iter (+/- 556.17) = 594 MB/s
test sha3_265_100 ... bench: 173.41 ns/iter (+/- 4.98) = 578 MB/s
test sha3_384_10 ... bench: 24.32 ns/iter (+/- 1.16) = 416 MB/s
test sha3_384_100 ... bench: 225.00 ns/iter (+/- 5.50) = 444 MB/s
test sha3_384_1000 ... bench: 2,224.49 ns/iter (+/- 47.86) = 449 MB/s
test sha3_384_10000 ... bench: 22,181.02 ns/iter (+/- 971.37) = 450 MB/s
test sha3_512_10 ... bench: 33.78 ns/iter (+/- 0.32) = 303 MB/s
test sha3_512_100 ... bench: 320.54 ns/iter (+/- 10.77) = 312 MB/s
test sha3_512_1000 ... bench: 3,174.62 ns/iter (+/- 80.98) = 315 MB/s
test sha3_512_10000 ... bench: 31,629.97 ns/iter (+/- 871.85) = 316 MB/s
test shake128_10 ... bench: 15.97 ns/iter (+/- 0.44) = 666 MB/s
test shake128_100 ... bench: 142.19 ns/iter (+/- 6.58) = 704 MB/s
test shake128_1000 ... bench: 1,390.27 ns/iter (+/- 56.14) = 719 MB/s
test shake128_10000 ... bench: 13,813.13 ns/iter (+/- 677.65) = 723 MB/s
test shake256_10 ... bench: 19.06 ns/iter (+/- 0.44) = 526 MB/s
test shake256_100 ... bench: 173.50 ns/iter (+/- 4.26) = 578 MB/s
test shake256_1000 ... bench: 1,695.05 ns/iter (+/- 87.19) = 589 MB/s
test shake256_10000 ... bench: 16,882.98 ns/iter (+/- 683.56) = 592 MB/s
## This new intrinsics implementation
test sha3_224_10 ... bench: 13.07 ns/iter (+/- 0.55) = 769 MB/s
test sha3_224_100 ... bench: 111.29 ns/iter (+/- 6.62) = 900 MB/s
test sha3_224_1000 ... bench: 1,113.87 ns/iter (+/- 29.88) = 898 MB/s
test sha3_224_10000 ... bench: 11,095.95 ns/iter (+/- 302.99) = 901 MB/s
test sha3_256_10 ... bench: 13.53 ns/iter (+/- 0.51) = 769 MB/s
test sha3_256_1000 ... bench: 1,173.40 ns/iter (+/- 33.72) = 852 MB/s
test sha3_256_10000 ... bench: 12,305.99 ns/iter (+/- 623.31) = 812 MB/s
test sha3_265_100 ... bench: 118.16 ns/iter (+/- 2.85) = 847 MB/s
test sha3_384_10 ... bench: 17.27 ns/iter (+/- 0.78) = 588 MB/s
test sha3_384_100 ... bench: 153.80 ns/iter (+/- 5.42) = 653 MB/s
test sha3_384_1000 ... bench: 1,529.35 ns/iter (+/- 18.99) = 654 MB/s
test sha3_384_10000 ... bench: 15,239.19 ns/iter (+/- 189.19) = 656 MB/s
test sha3_512_10 ... bench: 23.43 ns/iter (+/- 0.95) = 434 MB/s
test sha3_512_100 ... bench: 218.97 ns/iter (+/- 4.01) = 458 MB/s
test sha3_512_1000 ... bench: 2,193.58 ns/iter (+/- 37.98) = 455 MB/s
test sha3_512_10000 ... bench: 21,968.75 ns/iter (+/- 385.75) = 455 MB/s
test shake128_10 ... bench: 11.47 ns/iter (+/- 0.32) = 909 MB/s
test shake128_100 ... bench: 95.51 ns/iter (+/- 1.32) = 1052 MB/s
test shake128_1000 ... bench: 960.08 ns/iter (+/- 34.57) = 1041 MB/s
test shake128_10000 ... bench: 9,564.39 ns/iter (+/- 255.34) = 1045 MB/s
test shake256_10 ... bench: 13.61 ns/iter (+/- 0.53) = 769 MB/s
test shake256_100 ... bench: 116.77 ns/iter (+/- 1.94) = 862 MB/s
test shake256_1000 ... bench: 1,163.09 ns/iter (+/- 27.17) = 859 MB/s
test shake256_10000 ... bench: 11,750.47 ns/iter (+/- 250.38) = 851 MB/s
## Original assembly
test sha3_224_10 ... bench: 12.54 ns/iter (+/- 0.43) = 833 MB/s
test sha3_224_100 ... bench: 109.49 ns/iter (+/- 2.54) = 917 MB/s
test sha3_224_1000 ... bench: 1,095.79 ns/iter (+/- 32.04) = 913 MB/s
test sha3_224_10000 ... bench: 10,953.02 ns/iter (+/- 157.49) = 912 MB/s
test sha3_256_10 ... bench: 13.05 ns/iter (+/- 0.25) = 769 MB/s
test sha3_256_1000 ... bench: 1,161.46 ns/iter (+/- 28.09) = 861 MB/s
test sha3_256_10000 ... bench: 11,609.98 ns/iter (+/- 148.88) = 861 MB/s
test sha3_265_100 ... bench: 118.17 ns/iter (+/- 7.42) = 847 MB/s
test sha3_384_10 ... bench: 17.07 ns/iter (+/- 2.80) = 588 MB/s
test sha3_384_100 ... bench: 151.93 ns/iter (+/- 4.39) = 662 MB/s
test sha3_384_1000 ... bench: 1,506.50 ns/iter (+/- 40.71) = 664 MB/s
test sha3_384_10000 ... bench: 15,119.04 ns/iter (+/- 495.59) = 661 MB/s
test sha3_512_10 ... bench: 22.93 ns/iter (+/- 0.53) = 454 MB/s
test sha3_512_100 ... bench: 216.77 ns/iter (+/- 7.42) = 462 MB/s
test sha3_512_1000 ... bench: 2,165.67 ns/iter (+/- 49.04) = 461 MB/s
test sha3_512_10000 ... bench: 21,666.71 ns/iter (+/- 651.02) = 461 MB/s
test shake128_10 ... bench: 11.30 ns/iter (+/- 0.14) = 909 MB/s
test shake128_100 ... bench: 94.75 ns/iter (+/- 3.86) = 1063 MB/s
test shake128_1000 ... bench: 961.72 ns/iter (+/- 81.88) = 1040 MB/s
test shake128_10000 ... bench: 9,573.39 ns/iter (+/- 311.05) = 1044 MB/s
test shake256_10 ... bench: 13.17 ns/iter (+/- 0.54) = 769 MB/s
test shake256_100 ... bench: 117.39 ns/iter (+/- 3.22) = 854 MB/s
test shake256_1000 ... bench: 1,174.65 ns/iter (+/- 45.62) = 851 MB/s
test shake256_10000 ... bench: 11,659.19 ns/iter (+/- 330.23) = 857 MB/s
The performance seems pretty close to the original assembly, maybe just
slightly slower.
2026-02-27 17:36:55 -07:00
Tony Arcieri
cf29ae32c6
keccak v0.2.0-rc.2 ( #111 )
2026-02-26 10:56:38 -07:00
Tony Arcieri
38d10d2194
keccak: extract Keccak1600 struct with CPU feature detection ( #107 )
...
Extracts a struct to hold the state for Keccak-p1600/Keccak-f1600, along
with a CPU feature detection `InitToken` which is queried at the time
the state is initialized.
The previous `p1600`/`f1600` functions with CPU feature detection
support have been factored onto this struct, leaving the software
implementation available unconditionally as part of the public API, and
avoiding performing CPU feature detection on each invocation of the
permutation.
It looks like it should be possible to slot a struct like this into
something like `Sha3HasherCore` in place of its current `state` array.
2026-02-17 12:33:46 -07:00
Tony Arcieri
9dc0b8d950
keccak: replace asm/simd features with --cfg keccak_backend ( #106 )
...
Replaces these non-additive "features" with a 1-of-n backend selection
enabled by using `cfg` instead.
- `asm` => `--cfg keccak_backend="armv8_asm"`
- `simd` => `--cfg keccak_backend="simd"`
Closes #85
2026-02-13 16:04:57 -07:00
Tony Arcieri
a1be08a742
Replace no_unroll feature(s) with soft-compact cfg ( #105 )
...
The following crates now have a new `cfg` for backend selection:
- `ascon`: `--cfg ascon_backend="soft-compact"`
- `keccak`: `--cfg keccak_backend="soft-compact"`
This replaces the previous crate features, as suggested in #85
2026-02-13 12:00:57 -07:00
Tony Arcieri
b27e9bff49
keccak: add CHANGELOG.md entry for v0.1.6 ( #104 )
...
Released in #103
2026-02-13 11:31:51 -07:00
Tony Arcieri
7ac1920198
keccak: ARMv8 asm! cleanups ( #101 )
...
We pass in `state.as_mut_ptr()` as `x0`, which was previously marked as
`in`. However, it's modified in the `asm!`, e.g.:
sub x0, x0, #192
Note: it's also post-incremented by `ld1.1d` as state is loaded.
Since it's modified, it needs to be `inout`. This marks it as such,
using the `=> _` syntax to discard the result, then it's reset, then
modified as state is written).
Similar mutations were occurring with `x1` and `x8` as well, which have
been modified accordingly.
2026-02-13 07:29:27 -07:00
Tony Arcieri
239ff349af
Add Trusted Publishing Config ( #102 )
2026-02-12 19:20:35 -07:00
Tony Arcieri
0d9bf82ee5
Add workspace-level clippy config ( #100 )
...
Uses the same config from other repos (e.g. `traits`, `utils`)
2026-02-12 15:01:09 -07:00
Tony Arcieri
c3a9ef249e
keccak: bump cpufeatures to v0.3 ( #99 )
2026-02-12 12:20:53 -07:00
Tony Arcieri
d0c9b2a828
keccak v0.2.0-rc.1 ( #98 )
2026-01-22 11:10:05 -07:00
Tony Arcieri
4519b3bcb9
keccak: test asm feature in CI ( #97 )
...
Also fixes a warning for the ARMv8 `asm!` backend:
error[E0133]: use of inline assembly is unsafe and requires unsafe block
--> keccak/src/armv8.rs:8:5
|
8 | / core::arch::asm!("
9 | | // Read state
10 | | ld1.1d {{ v0- v3}}, [x0], #32
11 | | ld1.1d {{ v4- v7}}, [x0], #32
... |
119 | | options(nostack)
120 | | );
| |_____^ use of inline assembly
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html >
= note: inline assembly is entirely unchecked and can cause undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
--> keccak/src/armv8.rs:7:1
|
7 | pub unsafe fn p1600_armv8_sha3_asm(state: &mut [u64; 25], round_count: usize) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: `-D unsafe-op-in-unsafe-fn` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unsafe_op_in_unsafe_fn)]`
For more information about this error, try `rustc --explain E0133`.
2026-01-22 11:05:24 -07:00
Tony Arcieri
2d857d196b
keccak: test on aarch64-apple-darwin ( #96 )
...
Uses the native `macos-latest` runner.
I'm curious if this reproduces a warning I'm seeing locally.
2026-01-22 10:52:27 -07:00
Artyom Pavlov
b7f87707ee
bash-f: tweak benchmarks ( #94 )
2025-10-24 01:59:24 +03:00
Artyom Pavlov
868527a13c
bash-f: minor tweaks ( #93 )
2025-10-24 01:26:08 +03:00
Alexandr Kitaev
4d778574a6
Add bash-f (STB 34.101.77-2020) ( #92 )
2025-10-24 00:49:57 +03:00
qj
f205d0efbb
Use doc_cfg in place of removed doc_auto_cfg feature ( #91 )
2025-10-05 23:13:30 +03:00
Tony Arcieri
95a176c25b
Cut new prereleases ( #90 )
...
Releases the following:
- `ascon` v0.5.0-rc.0
- `keccak` v0.2.0-rc.0
2025-09-02 20:15:00 -06:00
Tony Arcieri
2bc1c383a4
Upgrade to Rust 2024 edition; MSRV 1.85 ( #89 )
2025-09-02 20:09:23 -06:00
Артём Павлов [Artyom Pavlov]
13e501fa4e
Update Cargo.lock
2025-01-25 18:38:04 +03:00
Artyom Pavlov
e47d6337ff
Update Cargo.lock ( #83 )
2024-11-22 09:46:14 +03:00
Artyom Pavlov
710788be9e
Bump MSRV to 1.81 ( #84 )
2024-11-22 09:43:18 +03:00
dependabot[bot]
5902ea6e37
build(deps): bump cpufeatures from 0.2.14 to 0.2.15 ( #81 )
2024-11-12 07:49:19 -07:00
Thomas Coratger
7a6ee9c1f1
keccak_p: improve efficiency of Theta phase ( #80 )
2024-09-23 08:28:11 +03:00
dependabot[bot]
7b7196894d
build(deps): bump cpufeatures from 0.2.12 to 0.2.14 ( #79 )
2024-09-09 06:09:25 -06:00
Tony Arcieri
c2b25b65ca
README.md(s): use img.shields.io crate version badges
2024-09-04 19:48:50 -06:00
Luca Bruno
a30ba7775c
cargo: point repository metadata to clonable URLs ( #77 )
...
This tweaks the `repository` fields in Cargo metadata in order to use the correct (i.e. git clonable) URL.
The existing GitHub webUI URLs for each package have been retained and moved to `homepage` fields.
2024-06-10 07:48:30 -06:00
Tony Arcieri
3c63bd4e6c
Cargo.lock: bump zeroize to v1.8.1 ( #76 )
...
This is possible now that we've bumped `ascon`'s MSRV to 1.60
2024-06-05 08:05:33 -06:00
Sebastian Ramacher
8ef2e47617
ascon: MSRV 1.60 ( #75 )
2024-06-01 12:37:24 -06:00
dependabot[bot]
b82fdb2121
build(deps): bump actions/cache from 3 to 4 ( #72 )
...
Bumps [actions/cache](https://github.com/actions/cache ) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases )
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md )
- [Commits](https://github.com/actions/cache/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: actions/cache
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 06:42:42 -07:00
Tony Arcieri
b67665f9bb
keccak v0.2.0-pre.0 ( #71 )
2024-01-16 12:13:55 -07:00
Tony Arcieri
8b74c7fc1a
ascon/Cargo.toml: rust -> Rust
2024-01-16 12:11:08 -07:00
Tony Arcieri
7675b171ad
keccak: 2021 edition upgrade; MSRV 1.60 ( #70 )
...
`keccak` was previously excluded from the toplevel workspace due to its
MSRV of 1.41 and incompatibilities with packages used by `ascon`.
This bumps the edition, changes the version to `0.2.0-pre` to denote it
contains breaking changes (though this is not intended to be a
`0.2.0-pre` release), and bumps MSRV.
With the MSRV bumped, `keccak` can and has been re-added to the toplevel
workspace.
2024-01-12 14:45:05 -07:00
Tony Arcieri
40c50c1641
keccak v0.1.5 ( #69 )
2024-01-12 11:30:01 -07:00
Coda Hale
2dc13bf92e
keccak: enable asm backend for p1600 ( #68 )
2024-01-09 12:41:20 -07:00
Tony Arcieri
a3a4e01607
Revert "Update Cargo.lock" ( #67 )
...
This reverts commit 3a9a29ef77f4718b6a385d08779d098dded51ef7.
This update is higher than the current Ascon MSRV and broke the build
2023-12-09 14:46:16 -07:00
Артём Павлов [Artyom Pavlov]
3a9a29ef77
Update Cargo.lock
2023-11-18 15:32:47 +03:00
Tony Arcieri
9e4f6bc695
keccak: don't test simd feature in minimal-versions workflow ( #66 )
...
It requires `nightly`, whereas the tests are run under `stable`.
The `simd` feature itself is already tested in the `test-simd` job.
2023-11-18 15:31:51 +03:00
Artyom Pavlov
329d4cdcb1
Replace cross tests with MIRI ( #63 )
2023-09-12 17:19:27 +03:00
dependabot[bot]
48cc4acf38
build(deps): bump actions/checkout from 3 to 4 ( #61 )
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 08:58:53 -06:00
Tony Arcieri
651a34ea2f
keccak: replace CI tests on MIPS with PPC32 ( #62 )
...
`mips-unknown-linux-gnu` is now a Tier 3 target: rust-lang/rust#115218 .
This means we can't use it for cross tests anymore since std is no
longer built for it.
This commit replaces it with `powerpc-unknown-linux-gnu`, a big endian
Tier 2 target.
2023-09-11 08:39:33 -06:00