feat: add the gcm crack

Example testcase is working
This commit is contained in:
Alivecow 2024-12-03 16:52:21 +01:00
parent 16b65b0de4
commit 4c9adb9fdc
7 changed files with 253 additions and 24 deletions

View file

@ -1,7 +1,7 @@
use crate::utils::field::ByteArray;
use base64::prelude::*;
use num::traits::FromBytes;
use num::traits::{FromBytes, ToBytes};
use num::{BigInt, BigUint, One, Zero};
use std::{str::FromStr, u128, u8, usize};
@ -31,6 +31,10 @@ impl Polynomial {
self.polynomial.len() - 1
}
pub fn empty() -> Polynomial {
Polynomial::new(vec![])
}
pub fn one() -> Self {
Polynomial::new(vec![FieldElement::one()])
}
@ -373,6 +377,10 @@ impl Polynomial {
self
}
pub fn extract_component(&self, i: u32) -> FieldElement {
self.polynomial[i as usize].clone()
}
}
impl Clone for Polynomial {