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,4 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use base64::prelude::*;
|
||||
use serde_json::Value;
|
||||
use std::{fmt::format, str::FromStr, u128, u8};
|
||||
|
||||
pub fn get_alpha_rep(num: u128) -> String {
|
||||
|
|
@ -19,6 +21,17 @@ pub fn get_alpha_rep(num: u128) -> String {
|
|||
alpha_rep
|
||||
}
|
||||
|
||||
pub fn block_2_number(string: String) -> Result<u128> {
|
||||
//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);
|
||||
|
||||
Ok(number)
|
||||
}
|
||||
|
||||
pub fn get_coefficients(num: u128) -> Vec<u8> {
|
||||
let mut powers: Vec<u8> = vec![];
|
||||
for shift in 0..128 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue