chore: claen up debug prints
This commit is contained in:
parent
76cbe0d4c0
commit
32bc8725e2
4 changed files with 23 additions and 43 deletions
|
|
@ -11,8 +11,6 @@ use crate::utils::{
|
|||
pub const RED_POLY: u128 = 0x87000000_00000000_00000000_00000000;
|
||||
|
||||
pub fn gfmul(args: &Value) -> Result<String> {
|
||||
eprintln!("{args}");
|
||||
|
||||
let mut red_poly_bytes: ByteArray = ByteArray(RED_POLY.to_be_bytes().to_vec());
|
||||
red_poly_bytes.0.push(0x01);
|
||||
|
||||
|
|
@ -24,9 +22,6 @@ pub fn gfmul(args: &Value) -> Result<String> {
|
|||
let mut poly2: ByteArray = ByteArray(BASE64_STANDARD.decode(poly2_text)?);
|
||||
poly2.0.push(0x00);
|
||||
|
||||
eprintln!("poly1 is: {:01X?}", poly1);
|
||||
eprintln!("poly2 is: {:01X?}", poly2);
|
||||
|
||||
let mut result: ByteArray = ByteArray(vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
if poly2.LSB_is_one() {
|
||||
|
|
@ -40,25 +35,10 @@ pub fn gfmul(args: &Value) -> Result<String> {
|
|||
if poly2.LSB_is_one() {
|
||||
poly1.left_shift();
|
||||
poly1.xor_byte_arrays(&red_poly_bytes);
|
||||
eprintln!("Poly1 after reduction: {:01X?}", poly1);
|
||||
result.xor_byte_arrays(&poly1);
|
||||
eprintln!(
|
||||
"LSB was one; \n
|
||||
poly1 is {:01X?}; \n
|
||||
poly2 is {:01X?}; \n
|
||||
result is: {:01X?}",
|
||||
poly1.0, poly2.0, result.0
|
||||
)
|
||||
} else {
|
||||
poly1.left_shift();
|
||||
poly1.xor_byte_arrays(&red_poly_bytes);
|
||||
eprintln!(
|
||||
"LSB was 0; \n
|
||||
poly1 is {:01X?}; \n
|
||||
poly2 is {:01X?}; \n
|
||||
result is: {:01X?}",
|
||||
poly1.0, poly2.0, result.0
|
||||
)
|
||||
}
|
||||
poly2.right_shift();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,6 @@
|
|||
{
|
||||
"testcases": {
|
||||
"b856d760-023d-4b00-bad2-15d2b6da22fe": {
|
||||
"action": "block2poly",
|
||||
"arguments": {
|
||||
"semantic": "xex",
|
||||
"block": "ARIAAAAAAAAAAAAAAAAAgA=="
|
||||
}
|
||||
},
|
||||
"254eaee7-05fd-4e0d-8292-9b658a852245": {
|
||||
"action": "poly2block",
|
||||
"arguments": {
|
||||
"semantic": "xex",
|
||||
"coefficients": [
|
||||
12,
|
||||
127,
|
||||
9,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"254eaee7-05fd-4e0d-8292-9b658a852245": {
|
||||
"action": "gfmul",
|
||||
"arguments": {
|
||||
"semantic": "xex",
|
||||
|
|
@ -28,7 +8,7 @@
|
|||
"b": "AgAAAAAAAAAAAAAAAAAAAA=="
|
||||
}
|
||||
},
|
||||
"b856d760-023d-4b00-bad2-15d2b6da22fe": {
|
||||
"b8f6d760-023d-4b00-bad2-15d2b6da22fe": {
|
||||
"action": "sea128",
|
||||
"arguments": {
|
||||
"mode": "encrypt",
|
||||
|
|
@ -43,5 +23,26 @@
|
|||
"key": "istDASeincoolerKEYrofg==",
|
||||
"input": "D5FDo3iVBoBN9gVi9/MSKQ=="
|
||||
}
|
||||
},
|
||||
"b856d760-023d-4b00-bad2-15d2b6da22fe": {
|
||||
"action": "block2poly",
|
||||
"arguments": {
|
||||
"semantic": "xex",
|
||||
"block": "ARIAAAAAAAAAAAAAAAAAgA=="
|
||||
}
|
||||
},
|
||||
"254eafe7-05fd-4e0d-8292-9b658a852245": {
|
||||
"action": "poly2block",
|
||||
"arguments": {
|
||||
"semantic": "xex",
|
||||
"coefficients": [
|
||||
12,
|
||||
127,
|
||||
9,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ pub fn get_coefficients(num: u128) -> Vec<u8> {
|
|||
for shift in 0..128 {
|
||||
//println!("{:?}", ((num >> shift) & 1));
|
||||
if ((num >> shift) & 1) == 1 {
|
||||
dbg!("Shift success");
|
||||
powers.push(shift);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue