WIP feat: initial gfmul algo. Not working yet.
This commit is contained in:
parent
c416547067
commit
bbae7d6f8b
5 changed files with 79 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use std::{str::Bytes, string};
|
||||
|
||||
use crate::utils::poly::{self, get_coefficients};
|
||||
use crate::utils::poly::{self, block_2_number, get_coefficients};
|
||||
use anyhow::Result;
|
||||
use base64::prelude::*;
|
||||
use serde_json::Value;
|
||||
|
|
@ -9,11 +9,7 @@ pub fn block2poly(val: &Value) -> Result<Vec<u8>> {
|
|||
// Convert JSON data in to a u128
|
||||
// TODO: Transfer decoding into own function?
|
||||
let string: String = serde_json::from_value(val["block"].clone())?;
|
||||
let decoded: Vec<u8> = BASE64_STANDARD.decode(string)?;
|
||||
|
||||
let mut bytes: [u8; 16] = [0u8; 16];
|
||||
bytes.copy_from_slice(&decoded);
|
||||
let number: u128 = <u128>::from_ne_bytes(bytes);
|
||||
let number: u128 = block_2_number(string)?;
|
||||
|
||||
let coefficients: Vec<u8> = get_coefficients(number);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue