feat: Add functionality to read path from stdin and rund tasks

This commit is contained in:
0xalivecow 2024-10-20 18:34:52 +02:00
parent 43bea77392
commit 52dca1bcaf
No known key found for this signature in database
5 changed files with 29 additions and 17 deletions

View file

@ -2,7 +2,12 @@ use crate::utils::poly::{self, coefficient_to_binary};
use base64::prelude::*;
use serde_json::Value;
pub fn poly2block(coefficients: Vec<u8>) -> String {
pub fn poly2block(args: &Value) -> String {
let coefficients: Vec<u8> = args["coefficients"]
.as_array()
.unwrap()
.into_iter()
.map(|x| x.as_u64().unwrap() as u8)
.collect();
BASE64_STANDARD.encode(poly::coefficient_to_binary(coefficients).to_ne_bytes())
}