refactor: externalise function to get coefficients
This commit is contained in:
parent
963239903e
commit
24611a2357
3 changed files with 24 additions and 25 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use std::{str::Bytes, string};
|
||||
|
||||
use crate::utils::poly;
|
||||
use crate::utils::poly::{self, get_coefficients};
|
||||
use anyhow::Result;
|
||||
use base64::prelude::*;
|
||||
use serde_json::Value;
|
||||
|
|
@ -16,15 +16,7 @@ pub fn block2poly(val: &Value) -> Result<Vec<u8>> {
|
|||
bytes.copy_from_slice(&decoded);
|
||||
let number: u128 = <u128>::from_ne_bytes(bytes);
|
||||
|
||||
let mut coefficients: Vec<u8> = vec![];
|
||||
|
||||
for shift in 0..128 {
|
||||
//println!("{:?}", ((num >> shift) & 1));
|
||||
if ((number >> shift) & 1) == 1 {
|
||||
println!("Shift success");
|
||||
coefficients.push(shift);
|
||||
}
|
||||
}
|
||||
let coefficients: Vec<u8> = get_coefficients(number);
|
||||
|
||||
Ok(coefficients)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue