Skip to main content

nautilus_lighter/signing/hash/
mod.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Poseidon2 hash over the Goldilocks field used by the Lighter signer.
17//!
18//! Exposes the fixed-width permutation [`permute`] together with the sponge
19//! API the Lighter Schnorr binding consumes ([`hash_no_pad`],
20//! [`hash_two_to_one`], [`hash_n_to_one`], [`hash_to_quintic_extension`]).
21//! Parameter constants live in [`params`] and were transcribed from the
22//! Apache-2.0 Go reference; equivalence is verified by fixture vectors under
23//! `test_data/`.
24
25pub mod params;
26mod poseidon2;
27
28pub use params::{RATE, ROUNDS_F, ROUNDS_F_HALF, ROUNDS_P, WIDTH};
29pub use poseidon2::{
30    HASH_OUT, hash_n_to_hash_no_pad, hash_n_to_m_no_pad, hash_n_to_one, hash_no_pad,
31    hash_to_quintic_extension, hash_two_to_one, hash_two_to_quintic, permute,
32};