Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions nomos-da/kzgrs/src/bdfg_proving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ use rayon::iter::{IntoParallelIterator as _, ParallelIterator as _};
use super::{Commitment, Evaluations, GlobalParameters, PolynomialEvaluationDomain, Proof, kzg};
use crate::fk20::{Toeplitz1Cache, fk20_batch_generate_elements_proofs};

const ROW_HASH_SIZE: usize = 31;

/// Generate a hash of the row commitments using the `Blake2bVar` hashing
/// algorithm.
///
/// This function hashes a list of commitments into a constant-size (32 bytes)
/// This function hashes a list of commitments into a constant-size (31 bytes)
/// hash vector. The hashing process involves serializing each commitment in an
/// uncompressed format and feeding the serialized data into the `Blake2bVar`
/// hasher.
Expand All @@ -30,7 +32,7 @@ use crate::fk20::{Toeplitz1Cache, fk20_batch_generate_elements_proofs};
///
/// # Returns
///
/// A `Vec<u8>` representing the 32-byte hash of the input commitments.
/// A `Vec<u8>` representing the 31-byte hash of the input commitments.
///
/// # Panics
///
Expand All @@ -40,7 +42,7 @@ use crate::fk20::{Toeplitz1Cache, fk20_batch_generate_elements_proofs};
/// - The hash finalization process fails.
#[must_use]
pub fn generate_row_commitments_hash(commitments: &[Commitment]) -> Vec<u8> {
let mut hasher = Blake2bVar::new(32).expect("Hasher should be able to build");
let mut hasher = Blake2bVar::new(ROW_HASH_SIZE).expect("Hasher should be able to build");
// add dst for hashing
hasher.update(b"NOMOS_DA_V1");
for c in commitments {
Expand All @@ -49,7 +51,7 @@ pub fn generate_row_commitments_hash(commitments: &[Commitment]) -> Vec<u8> {
.expect("serialization");
hasher.update(&buffer.into_inner());
}
let mut buffer = [0; 32];
let mut buffer = [0; ROW_HASH_SIZE];
hasher
.finalize_variable(&mut buffer)
.expect("Hashing should succeed");
Expand Down
Loading