Poly2Block; Block2Poly; SEA128 tasks working #2
5 changed files with 6 additions and 16 deletions
|
|
@ -1,18 +1,13 @@
|
||||||
use std::{
|
use std::collections::HashMap;
|
||||||
collections::HashMap,
|
|
||||||
fmt::format,
|
|
||||||
io::{self, Error, ErrorKind},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::utils::parse::{Responses, Testcase, Testcases};
|
use crate::utils::parse::{Responses, Testcase, Testcases};
|
||||||
use tasks01::{
|
use tasks01::{
|
||||||
block2poly::block2poly,
|
block2poly::block2poly,
|
||||||
poly2block::{self, poly2block},
|
poly2block::{poly2block},
|
||||||
sea128::sea128,
|
sea128::sea128,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
mod tasks01;
|
mod tasks01;
|
||||||
|
|
|
||||||
|
|
@ -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 anyhow::Result;
|
||||||
use base64::prelude::*;
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
pub fn block2poly(val: &Value) -> Result<Vec<u8>> {
|
pub fn block2poly(val: &Value) -> Result<Vec<u8>> {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::utils::poly::{self, coefficient_to_binary};
|
use crate::utils::poly::{self};
|
||||||
use base64::prelude::*;
|
use base64::prelude::*;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ use anyhow::{anyhow, Result};
|
||||||
use base64::prelude::*;
|
use base64::prelude::*;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::utils::{
|
use crate::utils::ciphers::{sea_128_decrypt, sea_128_encrypt};
|
||||||
ciphers::{sea_128_decrypt, sea_128_encrypt},
|
|
||||||
poly::b64_2_num,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn sea128(args: &Value) -> Result<String> {
|
pub fn sea128(args: &Value) -> Result<String> {
|
||||||
let key_string: String = serde_json::from_value(args["key"].clone())?;
|
let key_string: String = serde_json::from_value(args["key"].clone())?;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use base64::prelude::*;
|
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 {
|
pub fn get_alpha_rep(num: u128) -> String {
|
||||||
let powers: Vec<u8> = get_coefficients(num);
|
let powers: Vec<u8> = get_coefficients(num);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue