diff --git a/.gitignore b/.gitignore index ffc975e..6ce9b2c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ vendor/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -# Cargo.lock +Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/src/tasks/tasks01/gfmul.rs b/src/tasks/tasks01/gfmul.rs index 51afa60..0543d8f 100644 --- a/src/tasks/tasks01/gfmul.rs +++ b/src/tasks/tasks01/gfmul.rs @@ -11,8 +11,6 @@ use crate::utils::{ pub const RED_POLY: u128 = 0x87000000_00000000_00000000_00000000; pub fn gfmul(args: &Value) -> Result { - 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 { 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 { 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(); } diff --git a/src/test_json/kauma_tests.json b/src/test_json/kauma_tests.json index db68d6b..26f47f0 100644 --- a/src/test_json/kauma_tests.json +++ b/src/test_json/kauma_tests.json @@ -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 + ] + } + } } + } diff --git a/src/utils/poly.rs b/src/utils/poly.rs index 5ee7181..bd173e7 100644 --- a/src/utils/poly.rs +++ b/src/utils/poly.rs @@ -36,7 +36,6 @@ pub fn get_coefficients(num: u128) -> Vec { for shift in 0..128 { //println!("{:?}", ((num >> shift) & 1)); if ((num >> shift) & 1) == 1 { - dbg!("Shift success"); powers.push(shift); } }