From b24c70342900eb3f994dcc3179925bb96506c3a8 Mon Sep 17 00:00:00 2001 From: Alivecow Date: Sun, 22 Dec 2024 18:13:23 +0100 Subject: [PATCH] refactor: Apply general cargo recommendations --- src/tasks/tasks01/gcm_crack.rs | 5 +---- src/utils/ciphers.rs | 1 - src/utils/field.rs | 2 -- src/utils/poly.rs | 5 ++--- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/tasks/tasks01/gcm_crack.rs b/src/tasks/tasks01/gcm_crack.rs index 89788c7..09ccb2c 100644 --- a/src/tasks/tasks01/gcm_crack.rs +++ b/src/tasks/tasks01/gcm_crack.rs @@ -1,13 +1,10 @@ -use std::{env::args, fs::canonicalize, slice::Chunks}; use anyhow::{Ok, Result}; use base64::{prelude::BASE64_STANDARD, Engine}; -use openssl::derive; use serde::{Deserialize, Serialize}; -use serde_json::{map, Value}; +use serde_json::Value; use crate::utils::{ - self, ciphers::ghash, dff::ddf, edf::edf, diff --git a/src/utils/ciphers.rs b/src/utils/ciphers.rs index 82af34b..f147c5a 100644 --- a/src/utils/ciphers.rs +++ b/src/utils/ciphers.rs @@ -1,6 +1,5 @@ use crate::utils::{field::ByteArray, poly::gfmul}; use anyhow::Result; -use base64::prelude::*; use openssl::symm::{Cipher, Crypter, Mode}; use super::math::xor_bytes; diff --git a/src/utils/field.rs b/src/utils/field.rs index 13029cd..b5a65dc 100644 --- a/src/utils/field.rs +++ b/src/utils/field.rs @@ -8,9 +8,7 @@ use std::{ use anyhow::{anyhow, Ok, Result}; -use crate::utils::poly::bgfmul; -use super::poly::polynomial_2_block; use super::{ math::{reverse_bits_in_bytevec, xor_bytes}, poly::gfmul, diff --git a/src/utils/poly.rs b/src/utils/poly.rs index 61109f8..361108e 100644 --- a/src/utils/poly.rs +++ b/src/utils/poly.rs @@ -2,7 +2,7 @@ use crate::utils::field::ByteArray; use base64::prelude::*; use num::traits::{FromBytes, ToBytes}; -use num::{BigInt, BigUint, One, Zero}; +use num::{BigUint, One, Zero}; use std::{str::FromStr, u128, u8, usize}; @@ -15,7 +15,6 @@ use anyhow::{anyhow, Ok, Result}; use serde_json::Value; use super::field::FieldElement; -use super::math::reverse_bits_in_bytevec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Polynomial { @@ -574,7 +573,7 @@ pub fn sort_polynomial_array(mut polys: Vec) -> Result, poly_b: &Vec, semantic: &str) -> Result> { - 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); let mut poly1: ByteArray = ByteArray(poly_a.to_vec());