feat: gfmul fix algorithm. test is passing.

This commit is contained in:
0xalivecow 2024-10-26 17:57:14 +02:00
parent 4dc6cdfef8
commit 7564869ea8
No known key found for this signature in database
2 changed files with 24 additions and 5 deletions

View file

@ -69,8 +69,8 @@ mod tests {
#[test]
fn test_byte_array_shift2() {
let mut byte_array: ByteArray = ByteArray(vec![0x00, 0xFF]);
let shifted_array: ByteArray = ByteArray(vec![0x01, 0xFE]);
let mut byte_array: ByteArray = ByteArray(vec![0xFF, 0x00]);
let shifted_array: ByteArray = ByteArray(vec![0xFE, 0x01]);
byte_array.left_shift();
assert_eq!(
@ -80,13 +80,29 @@ mod tests {
);
}
#[test]
fn test_byte_array_shift_right() {
let mut byte_array: ByteArray = ByteArray(vec![0x02]);
let shifted_array: ByteArray = ByteArray(vec![0x01]);
byte_array.right_shift();
assert_eq!(
byte_array.0, shifted_array.0,
"Failure: Shifted array was: {:?}",
byte_array.0
);
}
#[test]
fn test_lsb_one() {
let mut byte_array: ByteArray = ByteArray(vec![0x00, 0xFF]);
assert!(byte_array.LSB_is_one());
assert!(!byte_array.LSB_is_one());
let mut byte_array2: ByteArray = ByteArray(vec![0x00, 0x02]);
let mut byte_array2: ByteArray = ByteArray(vec![0x02, 0xFF]);
assert!(!byte_array2.LSB_is_one());
let mut byte_array3: ByteArray = ByteArray(vec![0xFF, 0x00]);
assert!(byte_array3.LSB_is_one());
}
#[test]