From 35eae2720745d0629b6732e209b619a37577077e Mon Sep 17 00:00:00 2001 From: mmagician Date: Mon, 24 Jun 2024 17:58:53 +0200 Subject: [PATCH] implement absorb for Ligero pp --- poly-commit/src/linear_codes/ligero.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/poly-commit/src/linear_codes/ligero.rs b/poly-commit/src/linear_codes/ligero.rs index 51898dd1..7e36acdd 100644 --- a/poly-commit/src/linear_codes/ligero.rs +++ b/poly-commit/src/linear_codes/ligero.rs @@ -8,6 +8,7 @@ use crate::{ use ark_crypto_primitives::{ crh::{CRHScheme, TwoToOneCRHScheme}, merkle_tree::{Config, LeafParam, TwoToOneParam}, + sponge::Absorb, }; use ark_ff::PrimeField; use ark_std::{log2, marker::PhantomData}; @@ -96,6 +97,23 @@ where } } +impl Absorb for LigeroPCParams +where + F: PrimeField, + C: Config, + H: CRHScheme, +{ + fn to_sponge_bytes(&self, dest: &mut Vec) { + self.sec_param.to_sponge_bytes(dest); + self.rho_inv.to_sponge_bytes(dest); + } + + fn to_sponge_field_elements(&self, dest: &mut Vec) { + self.sec_param.to_sponge_field_elements(dest); + self.rho_inv.to_sponge_field_elements(dest); + } +} + impl LinCodeParametersInfo for LigeroPCParams where F: PrimeField,