refactor: Apply rust suggested changes

This commit is contained in:
0xalivecow 2024-10-23 10:24:13 +02:00
parent 067ef6141c
commit 8a92b884a1
No known key found for this signature in database
5 changed files with 6 additions and 16 deletions

View file

@ -1,18 +1,13 @@
use std::{
collections::HashMap,
fmt::format,
io::{self, Error, ErrorKind},
};
use std::collections::HashMap;
use crate::utils::parse::{Responses, Testcase, Testcases};
use tasks01::{
block2poly::block2poly,
poly2block::{self, poly2block},
poly2block::{poly2block},
sea128::sea128,
};
use anyhow::{anyhow, Result};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
mod tasks01;

View file

@ -1,8 +1,6 @@
use std::{str::Bytes, string};
use crate::utils::poly::{self, b64_2_num, get_coefficients};
use crate::utils::poly::{b64_2_num, get_coefficients};
use anyhow::Result;
use base64::prelude::*;
use serde_json::Value;
pub fn block2poly(val: &Value) -> Result<Vec<u8>> {

View file

@ -1,4 +1,4 @@
use crate::utils::poly::{self, coefficient_to_binary};
use crate::utils::poly::{self};
use base64::prelude::*;
use serde_json::Value;

View file

@ -2,10 +2,7 @@ use anyhow::{anyhow, Result};
use base64::prelude::*;
use serde_json::Value;
use crate::utils::{
ciphers::{sea_128_decrypt, sea_128_encrypt},
poly::b64_2_num,
};
use crate::utils::ciphers::{sea_128_decrypt, sea_128_encrypt};
pub fn sea128(args: &Value) -> Result<String> {
let key_string: String = serde_json::from_value(args["key"].clone())?;

View file

@ -1,6 +1,6 @@
use anyhow::Result;
use base64::prelude::*;
use std::{fmt::format, str::FromStr, u128, u8};
use std::{str::FromStr, u128, u8};
pub fn get_alpha_rep(num: u128) -> String {
let powers: Vec<u8> = get_coefficients(num);