From cf45280ad5c95f9c7ad218f5a6de20124de73817 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Tue, 18 Jun 2024 20:45:33 +0100 Subject: [PATCH] chore: add banderwagon subgroup check --- banderwagon/src/element.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/banderwagon/src/element.rs b/banderwagon/src/element.rs index 5c2775a..b30f460 100644 --- a/banderwagon/src/element.rs +++ b/banderwagon/src/element.rs @@ -246,6 +246,18 @@ mod tests { hex_to_fq("38045b6a248d6f9bbb789cf86504ec70d2dde0b5467e13d795c55129d4cdf1d4"), ); + // Do the banderwagon subgroup checks + { + let g0 = Element(g0.into()); + let g1 = Element(g1.into()); + if !g0.subgroup_check() { + panic!("g0 element not in the right subgroup"); + } + if !g1.subgroup_check() { + panic!("g1 element not in the right subgroup"); + } + } + let a = hex_to_fr("0cfe04d11eada0fb11085a64613291830a60c6b7f4f1341e9b59f9867bd1bad5"); // def test1():