Merge refactoring changes #34

Merged
0xalivecow merged 4 commits from dev into main 2024-12-23 09:31:55 +00:00
4 changed files with 3 additions and 10 deletions
Showing only changes of commit b24c703429 - Show all commits

View file

@ -1,13 +1,10 @@
use std::{env::args, fs::canonicalize, slice::Chunks};
use anyhow::{Ok, Result}; use anyhow::{Ok, Result};
use base64::{prelude::BASE64_STANDARD, Engine}; use base64::{prelude::BASE64_STANDARD, Engine};
use openssl::derive;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{map, Value}; use serde_json::Value;
use crate::utils::{ use crate::utils::{
self,
ciphers::ghash, ciphers::ghash,
dff::ddf, dff::ddf,
edf::edf, edf::edf,

View file

@ -1,6 +1,5 @@
use crate::utils::{field::ByteArray, poly::gfmul}; use crate::utils::{field::ByteArray, poly::gfmul};
use anyhow::Result; use anyhow::Result;
use base64::prelude::*;
use openssl::symm::{Cipher, Crypter, Mode}; use openssl::symm::{Cipher, Crypter, Mode};
use super::math::xor_bytes; use super::math::xor_bytes;

View file

@ -8,9 +8,7 @@ use std::{
use anyhow::{anyhow, Ok, Result}; use anyhow::{anyhow, Ok, Result};
use crate::utils::poly::bgfmul;
use super::poly::polynomial_2_block;
use super::{ use super::{
math::{reverse_bits_in_bytevec, xor_bytes}, math::{reverse_bits_in_bytevec, xor_bytes},
poly::gfmul, poly::gfmul,

View file

@ -2,7 +2,7 @@ use crate::utils::field::ByteArray;
use base64::prelude::*; use base64::prelude::*;
use num::traits::{FromBytes, ToBytes}; use num::traits::{FromBytes, ToBytes};
use num::{BigInt, BigUint, One, Zero}; use num::{BigUint, One, Zero};
use std::{str::FromStr, u128, u8, usize}; use std::{str::FromStr, u128, u8, usize};
@ -15,7 +15,6 @@ use anyhow::{anyhow, Ok, Result};
use serde_json::Value; use serde_json::Value;
use super::field::FieldElement; use super::field::FieldElement;
use super::math::reverse_bits_in_bytevec;
#[derive(Debug, serde::Serialize, serde::Deserialize)] #[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct Polynomial { pub struct Polynomial {
@ -574,7 +573,7 @@ pub fn sort_polynomial_array(mut polys: Vec<Polynomial>) -> Result<Vec<Polynomia
pub const RED_POLY: u128 = 0x87000000_00000000_00000000_00000000; pub const RED_POLY: u128 = 0x87000000_00000000_00000000_00000000;
pub fn gfmul(poly_a: &Vec<u8>, poly_b: &Vec<u8>, semantic: &str) -> Result<Vec<u8>> { pub fn gfmul(poly_a: &Vec<u8>, poly_b: &Vec<u8>, semantic: &str) -> Result<Vec<u8>> {
let mut red_poly_bytes: ByteArray = ByteArray(RED_POLY.to_be_bytes().to_vec()); let red_poly_bytes: ByteArray = ByteArray(RED_POLY.to_be_bytes().to_vec());
//red_poly_bytes.0.push(0x01); //red_poly_bytes.0.push(0x01);
let mut poly1: ByteArray = ByteArray(poly_a.to_vec()); let mut poly1: ByteArray = ByteArray(poly_a.to_vec());