Skip to content

Commit

Permalink
fmt pass
Browse files Browse the repository at this point in the history
  • Loading branch information
AnarchistHoneybun committed Oct 13, 2024
1 parent 6c9d448 commit 3405811
Showing 1 changed file with 56 additions and 28 deletions.
84 changes: 56 additions & 28 deletions kupyna/src/tests/padding_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use hex_literal::hex;
fn pad_test_0() {
let message: [u8; 0] = [];

let expected_output: [u8; 128] = hex!("
let expected_output: [u8; 128] = hex!(
"
80000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
Expand All @@ -16,7 +17,8 @@ fn pad_test_0() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 0, STATE_SIZE_512);

Expand All @@ -27,7 +29,8 @@ fn pad_test_0() {
fn pad_test_8() {
let message: [u8; 1] = hex!("FF");

let expected_output: [u8; 128] = hex!("
let expected_output: [u8; 128] = hex!(
"
FF800000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
Expand All @@ -36,7 +39,8 @@ fn pad_test_8() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 08000000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 8, STATE_SIZE_512);

Expand All @@ -45,14 +49,17 @@ fn pad_test_8() {

#[test]
fn pad_test_510() {
let message: [u8; 64] = hex!("
let message: [u8; 64] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
30313233 34353637 38393A3B 3C3D3E3C
");
"
);

let expected_output: [u8; 128] = hex!("
let expected_output: [u8; 128] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -61,7 +68,8 @@ fn pad_test_510() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 FE010000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 510, STATE_SIZE_512);

Expand All @@ -70,14 +78,17 @@ fn pad_test_510() {

#[test]
fn pad_test_512() {
let message: [u8; 64] = hex!("
let message: [u8; 64] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
30313233 34353637 38393A3B 3C3D3E3F
");
"
);

let expected_output: [u8; 128] = hex!("
let expected_output: [u8; 128] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -86,7 +97,8 @@ fn pad_test_512() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00020000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 512, STATE_SIZE_512);

Expand All @@ -95,7 +107,8 @@ fn pad_test_512() {

#[test]
fn pad_test_1024() {
let message: [u8; 128] = hex!("
let message: [u8; 128] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -104,9 +117,11 @@ fn pad_test_1024() {
50515253 54555657 58595A5B 5C5D5E5F
60616263 64656667 68696A6B 6C6D6E6F
70717273 74757677 78797A7B 7C7D7E7F
");
"
);

let expected_output: [u8; 256] = hex!("
let expected_output: [u8; 256] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -123,7 +138,8 @@ fn pad_test_1024() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00040000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 1024, STATE_SIZE_512);

Expand All @@ -132,7 +148,8 @@ fn pad_test_1024() {

#[test]
fn pad_test_2048() {
let message: [u8; 256] = hex!("
let message: [u8; 256] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -149,9 +166,11 @@ fn pad_test_2048() {
D0D1D2D3 D4D5D6D7 D8D9DADB DCDDDEDF
E0E1E2E3 E4E5E6E7 E8E9EAEB ECEDEEEF
F0F1F2F3 F4F5F6F7 F8F9FAFB FCFDFEFF
");
"
);

let expected_output: [u8; 384] = hex!("
let expected_output: [u8; 384] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -176,7 +195,8 @@ fn pad_test_2048() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00080000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 2048, STATE_SIZE_512);

Expand All @@ -185,7 +205,8 @@ fn pad_test_2048() {

#[test]
fn pad_test_1536() {
let message: [u8; 192] = hex!("
let message: [u8; 192] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -198,9 +219,11 @@ fn pad_test_1536() {
90919293 94959697 98999A9B 9C9D9E9F
A0A1A2A3 A4A5A6A7 A8A9AAAB ACADAEAF
B0B1B2B3 B4B5B6B7 B8B9BABB BCBDBEBF
");
"
);

let expected_output: [u8; 256] = hex!("
let expected_output: [u8; 256] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -217,7 +240,8 @@ fn pad_test_1536() {
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00060000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 1536, STATE_SIZE_512);

Expand All @@ -226,16 +250,19 @@ fn pad_test_1536() {

#[test]
fn pad_test_655() {
let message: [u8; 82] = hex!("
let message: [u8; 82] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
30313233 34353637 38393A3B 3C3D3E3F
40414243 44454647 48494A4B 4C4D4E4F
5050
");
"
);

let expected_output: [u8; 128] = hex!("
let expected_output: [u8; 128] = hex!(
"
00010203 04050607 08090A0B 0C0D0E0F
10111213 14151617 18191A1B 1C1D1E1F
20212223 24252627 28292A2B 2C2D2E2F
Expand All @@ -244,7 +271,8 @@ fn pad_test_655() {
50510000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 8F020000 00000000 00000000
");
"
);

let padded_message = pad_message(&message, 655, STATE_SIZE_512);

Expand Down

0 comments on commit 3405811

Please sign in to comment.