Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Kindi-0 committed Sep 26, 2024
1 parent 3502542 commit 49f80ac
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions crypto/src/hash/mds/mds_f64_12x12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ use math::{
FieldElement,
};

/// This module contains helper functions as well as constants used to perform a 12x12 vector-matrix
/// multiplication. The special form of our MDS matrix i.e. being circulant, allows us to reduce
/// the vector-matrix multiplication to a Hadamard product of two vectors in "frequency domain".
/// This follows from the simple fact that every circulant matrix has the columns of the discrete
/// Fourier transform matrix as orthogonal eigenvectors.
/// The implementation also avoids the use of 3-point FFTs, and 3-point iFFTs, and substitutes that
/// with explicit expressions. It also avoids, due to the form of our matrix in the frequency domain,
/// divisions by 2 and repeated modular reductions. This is because of our explicit choice of
/// an MDS matrix that has small powers of 2 entries in frequency domain.
/// The following implementation has benefited greatly from the discussions and insights of
/// Hamish Ivey-Law and Jacqueline Nabaglo of Polygon Zero and is based on Nabaglo's implementation
/// in [Plonky2](https://github.com/mir-protocol/plonky2).
/// The circulant matrix is identified by its first row: [7, 23, 8, 26, 13, 10, 9, 7, 6, 22, 21, 8].
// This module contains helper functions as well as constants used to perform a 12x12 vector-matrix
// multiplication. The special form of our MDS matrix i.e. being circulant, allows us to reduce
// the vector-matrix multiplication to a Hadamard product of two vectors in "frequency domain".
// This follows from the simple fact that every circulant matrix has the columns of the discrete
// Fourier transform matrix as orthogonal eigenvectors.
// The implementation also avoids the use of 3-point FFTs, and 3-point iFFTs, and substitutes that
// with explicit expressions. It also avoids, due to the form of our matrix in the frequency domain,
// divisions by 2 and repeated modular reductions. This is because of our explicit choice of
// an MDS matrix that has small powers of 2 entries in frequency domain.
// The following implementation has benefited greatly from the discussions and insights of
// Hamish Ivey-Law and Jacqueline Nabaglo of Polygon Zero and is based on Nabaglo's implementation
// in [Plonky2](https://github.com/mir-protocol/plonky2).
// The circulant matrix is identified by its first row: [7, 23, 8, 26, 13, 10, 9, 7, 6, 22, 21, 8].

// MDS matrix in frequency domain.
// More precisely, this is the output of the three 4-point (real) FFTs of the first column of
Expand All @@ -33,6 +33,7 @@ use math::{
// The entries have been scaled appropriately in order to avoid divisions by 2 in iFFT2 and iFFT4.
// The code to generate the matrix in frequency domain is based on an adaptation of a code, to generate
// MDS matrices efficiently in original domain, that was developed by the Polygon Zero team.

const MDS_FREQ_BLOCK_ONE: [i64; 3] = [16, 8, 16];
const MDS_FREQ_BLOCK_TWO: [(i64, i64); 3] = [(-1, 2), (-1, 1), (4, 8)];
const MDS_FREQ_BLOCK_THREE: [i64; 3] = [-8, 1, 1];
Expand Down

0 comments on commit 49f80ac

Please sign in to comment.