mirror of
https://github.com/logos-blockchain/sponges.git
synced 2026-07-29 18:13:17 +00:00
feat: add a Risc0 backend
Defaults to software keccak on unoptimized rounds
This commit is contained in:
parent
c4b35a1346
commit
ff608af82a
23
keccak/src/backends/risc0.rs
Normal file
23
keccak/src/backends/risc0.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use crate::consts::F1600_ROUNDS;
|
||||
use crate::types::{Fn1600, State1600};
|
||||
#[cfg(feature = "parallel")]
|
||||
use hybrid_array::typenum::U1;
|
||||
|
||||
pub(crate) struct Backend;
|
||||
|
||||
impl super::Backend for Backend {
|
||||
#[cfg(feature = "parallel")]
|
||||
type ParSize1600 = U1;
|
||||
|
||||
#[inline]
|
||||
fn get_p1600<const ROUNDS: usize>() -> Fn1600 {
|
||||
if ROUNDS == F1600_ROUNDS {
|
||||
return risc0_p1600;
|
||||
}
|
||||
super::soft::keccak_p::<u64, ROUNDS>
|
||||
}
|
||||
}
|
||||
|
||||
fn risc0_p1600(state: &mut State1600) {
|
||||
risc0_zkvm::guest::env::risc0_keccak_update(state);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user