feat: ready test runner for monic and sqrt tasks
This commit is contained in:
parent
f75e7de733
commit
5bb9bcebff
4 changed files with 53 additions and 30 deletions
|
|
@ -9,7 +9,8 @@ use tasks01::{
|
|||
gfmul::gfmul_task,
|
||||
pad_oracle::padding_oracle,
|
||||
pfmath::{
|
||||
gfdiv, gfpoly_add, gfpoly_divmod, gfpoly_mul, gfpoly_pow, gfpoly_powmod, gfpoly_sort,
|
||||
gfdiv, gfpoly_add, gfpoly_divmod, gfpoly_make_monic, gfpoly_mul, gfpoly_pow, gfpoly_powmod,
|
||||
gfpoly_sort, gfpoly_sqrt,
|
||||
},
|
||||
poly2block::poly2block,
|
||||
sea128::sea128,
|
||||
|
|
@ -132,6 +133,18 @@ pub fn task_deploy(testcase: &Testcase) -> Result<Value> {
|
|||
|
||||
Ok(json)
|
||||
}
|
||||
"gfpoly_make_monic" => {
|
||||
let result = gfpoly_make_monic(args)?;
|
||||
let json = json!({"S" : result.to_c_array()});
|
||||
|
||||
Ok(json)
|
||||
}
|
||||
"gfpoly_sqrt" => {
|
||||
let result = gfpoly_sqrt(args)?;
|
||||
let json = json!({"S" : result.to_c_array()});
|
||||
|
||||
Ok(json)
|
||||
}
|
||||
|
||||
_ => Err(anyhow!(
|
||||
"Fatal. No compatible action found. Json data was {:?}. Arguments were; {:?}",
|
||||
|
|
|
|||
|
|
@ -81,6 +81,22 @@ pub fn gfpoly_sort(args: &Value) -> Result<Vec<Polynomial>> {
|
|||
Ok(polys)
|
||||
}
|
||||
|
||||
pub fn gfpoly_make_monic(args: &Value) -> Result<Polynomial> {
|
||||
let mut poly_a = Polynomial::from_c_array(&args["A"].clone());
|
||||
|
||||
poly_a.monic();
|
||||
|
||||
Ok(poly_a)
|
||||
}
|
||||
|
||||
pub fn gfpoly_sqrt(args: &Value) -> Result<Polynomial> {
|
||||
let poly_a = Polynomial::from_c_array(&args["Q"].clone());
|
||||
|
||||
let result = poly_a.sqrt();
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue