feat: add function for polynomial differentiation
This commit is contained in:
parent
b595276143
commit
4b1bca8ee0
5 changed files with 69 additions and 22 deletions
|
|
@ -9,8 +9,8 @@ use tasks01::{
|
|||
gfmul::gfmul_task,
|
||||
pad_oracle::padding_oracle,
|
||||
pfmath::{
|
||||
gfdiv, gfpoly_add, gfpoly_divmod, gfpoly_make_monic, gfpoly_mul, gfpoly_pow, gfpoly_powmod,
|
||||
gfpoly_sort, gfpoly_sqrt,
|
||||
gfdiv, gfpoly_add, gfpoly_diff, gfpoly_divmod, gfpoly_make_monic, gfpoly_mul, gfpoly_pow,
|
||||
gfpoly_powmod, gfpoly_sort, gfpoly_sqrt,
|
||||
},
|
||||
poly2block::poly2block,
|
||||
sea128::sea128,
|
||||
|
|
@ -145,6 +145,12 @@ pub fn task_deploy(testcase: &Testcase) -> Result<Value> {
|
|||
|
||||
Ok(json)
|
||||
}
|
||||
"gfpoly_diff" => {
|
||||
let result = gfpoly_diff(args)?;
|
||||
let json = json!({"F'" : result.to_c_array()});
|
||||
|
||||
Ok(json)
|
||||
}
|
||||
|
||||
_ => Err(anyhow!(
|
||||
"Fatal. No compatible action found. Json data was {:?}. Arguments were; {:?}",
|
||||
|
|
|
|||
|
|
@ -97,6 +97,14 @@ pub fn gfpoly_sqrt(args: &Value) -> Result<Polynomial> {
|
|||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn gfpoly_diff(args: &Value) -> Result<Polynomial> {
|
||||
let poly_f = Polynomial::from_c_array(&args["F"].clone());
|
||||
|
||||
let result = poly_f.diff();
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue