binius_hash/
permutation.rs

1// Copyright 2024-2025 Irreducible Inc.
2// Copyright (c) 2024 The Plonky3 Authors
3
4//! These interfaces are taken from [p3_symmetric](https://github.com/Plonky3/Plonky3/blob/main/symmetric/src/permutation.rs) in [Plonky3].
5//!
6//! [Plonky3]: <https://github.com/plonky3/plonky3>
7
8/// A permutation in the mathematical sense.
9pub trait Permutation<T: Clone>: Clone + Sync {
10	fn permute(&self, mut input: T) -> T {
11		self.permute_mut(&mut input);
12		input
13	}
14
15	fn permute_mut(&self, input: &mut T);
16}
17
18/// A permutation thought to be cryptographically secure, in the sense that it is thought to be
19/// difficult to distinguish (in a nontrivial way) from a random permutation.
20pub trait CryptographicPermutation<T: Clone>: Permutation<T> {}