p3_keccak/
fallback.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! This module should be included only when none of the more target-specific implementations are
//! available. It fills in a few things based on a pure Rust implementation of Keccak.

use core::mem::transmute;

use p3_symmetric::{CryptographicPermutation, Permutation};

use crate::KeccakF;

pub const VECTOR_LEN: usize = 1;

impl Permutation<[[u64; VECTOR_LEN]; 25]> for KeccakF {
    fn permute_mut(&self, input: &mut [[u64; VECTOR_LEN]; 25]) {
        let input: &mut [u64; 25] = unsafe { transmute(input) };
        self.permute_mut(input);
    }
}

impl CryptographicPermutation<[[u64; VECTOR_LEN]; 25]> for KeccakF {}