Skip to content

Commit 9e14592

Browse files
Merge pull request RustCrypto#8 from AnarchistHoneybun/no_std
qol for tests
2 parents 5232e7f + 233cb9e commit 9e14592

File tree

5 files changed

+18
-27
lines changed

5 files changed

+18
-27
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ target/
22
*/target/
33
*/*/target/
44
*/Cargo.lock
5-
.devcontainer/
5+

kupyna/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ hasher.update(b"my message");
2121
let hash = hasher.finalize();
2222

2323
assert_eq!(hash, hex!("538e2e238142df05e954702aa75d6942cebe30d44bd514df365d13bdcb6b1458"));
24+
25+
// Hex-encode hash using https://docs.rs/base16ct
26+
let hex_hash = base16ct::lower::encode_string(&hash);
27+
assert_eq!(hex_hash, "538e2e238142df05e954702aa75d6942cebe30d44bd514df365d13bdcb6b1458");
2428
```
2529

2630
Also, see the [examples section] in the RustCrypto/hashes readme.

kupyna/tests/kup256.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ fn kup256_n512() {
1414

1515
assert_eq!(
1616
result[..],
17-
hex!("08F4EE6F1BE6903B324C4E27990CB24EF69DD58DBE84813EE0A52F6631239875")[..],
18-
"Kupyna-256 did not produce the expected hash output"
17+
hex!("08F4EE6F1BE6903B324C4E27990CB24EF69DD58DBE84813EE0A52F6631239875")[..]
1918
);
2019
}
2120

@@ -34,8 +33,7 @@ fn kup256_n1024() {
3433

3534
assert_eq!(
3635
result[..],
37-
hex!("0A9474E645A7D25E255E9E89FFF42EC7EB31349007059284F0B182E452BDA882")[..],
38-
"Kupyna-256 did not produce the expected hash output"
36+
hex!("0A9474E645A7D25E255E9E89FFF42EC7EB31349007059284F0B182E452BDA882")[..]
3937
);
4038
}
4139

@@ -59,8 +57,7 @@ E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"
5957

6058
assert_eq!(
6159
result[..],
62-
hex!("D305A32B963D149DC765F68594505D4077024F836C1BF03806E1624CE176C08F")[..],
63-
"Kupyna-256 did not produce the expected hash output"
60+
hex!("D305A32B963D149DC765F68594505D4077024F836C1BF03806E1624CE176C08F")[..]
6461
);
6562
}
6663

@@ -75,8 +72,7 @@ fn kup256_n8() {
7572

7673
assert_eq!(
7774
result[..],
78-
hex!("EA7677CA4526555680441C117982EA14059EA6D0D7124D6ECDB3DEEC49E890F4")[..],
79-
"Kupyna-256 did not produce the expected hash output"
75+
hex!("EA7677CA4526555680441C117982EA14059EA6D0D7124D6ECDB3DEEC49E890F4")[..]
8076
);
8177
}
8278

@@ -95,8 +91,7 @@ fn kup256_n760() {
9591

9692
assert_eq!(
9793
result[..],
98-
hex!("1075C8B0CB910F116BDA5FA1F19C29CF8ECC75CAFF7208BA2994B68FC56E8D16")[..],
99-
"Kupyna-256 did not produce the expected hash output"
94+
hex!("1075C8B0CB910F116BDA5FA1F19C29CF8ECC75CAFF7208BA2994B68FC56E8D16")[..]
10095
);
10196
}
10297

@@ -111,7 +106,6 @@ fn kup256_n0() {
111106

112107
assert_eq!(
113108
result[..],
114-
hex!("CD5101D1CCDF0D1D1F4ADA56E888CD724CA1A0838A3521E7131D4FB78D0F5EB6")[..],
115-
"Kupyna-256 did not produce the expected hash output"
109+
hex!("CD5101D1CCDF0D1D1F4ADA56E888CD724CA1A0838A3521E7131D4FB78D0F5EB6")[..]
116110
);
117111
}

kupyna/tests/kup48.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ fn kup48_n512() {
1515

1616
assert_eq!(
1717
result[..],
18-
hex!("2F6631239875")[..],
19-
"Kupyna-48 did not produce the expected hash output"
18+
hex!("2F6631239875")[..]
2019
);
2120
}

kupyna/tests/kup512.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ fn kup512_n512() {
1818
hex!(
1919
"3813E2109118CDFB5A6D5E72F7208DCCC80A2DFB3AFDFB02F46992B5EDBE536B
2020
3560DD1D7E29C6F53978AF58B444E37BA685C0DD910533BA5D78EFFFC13DE62A"
21-
)[..],
22-
"Kupyna-256 did not produce the expected hash output"
21+
)[..]
2322
);
2423
}
2524

@@ -42,8 +41,7 @@ fn kup512_n1024() {
4241
hex!(
4342
"76ED1AC28B1D0143013FFA87213B4090B356441263C13E03FA060A8CADA32B97
4443
9635657F256B15D5FCA4A174DE029F0B1B4387C878FCC1C00E8705D783FD7FFE"
45-
)[..],
46-
"Kupyna-256 did not produce the expected hash output"
44+
)[..]
4745
);
4846
}
4947

@@ -70,8 +68,7 @@ E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"
7068
hex!(
7169
"0DD03D7350C409CB3C29C25893A0724F6B133FA8B9EB90A64D1A8FA93B565566
7270
11EB187D715A956B107E3BFC76482298133A9CE8CBC0BD5E1436A5B197284F7E"
73-
)[..],
74-
"Kupyna-256 did not produce the expected hash output"
71+
)[..]
7572
);
7673
}
7774

@@ -89,8 +86,7 @@ fn kup512_n8() {
8986
hex!(
9087
"871B18CF754B72740307A97B449ABEB32B64444CC0D5A4D65830AE5456837A72
9188
D8458F12C8F06C98C616ABE11897F86263B5CB77C420FB375374BEC52B6D0292"
92-
)[..],
93-
"Kupyna-256 did not produce the expected hash output"
89+
)[..]
9490
);
9591
}
9692

@@ -115,8 +111,7 @@ A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF"
115111
hex!(
116112
"B189BFE987F682F5F167F0D7FA565330E126B6E592B1C55D44299064EF95B1A5
117113
7F3C2D0ECF17869D1D199EBBD02E8857FB8ADD67A8C31F56CD82C016CF743121"
118-
)[..],
119-
"Kupyna-256 did not produce the expected hash output"
114+
)[..]
120115
);
121116
}
122117

@@ -134,7 +129,6 @@ fn kup512_n0() {
134129
hex!(
135130
"656B2F4CD71462388B64A37043EA55DBE445D452AECD46C3298343314EF04019
136131
BCFA3F04265A9857F91BE91FCE197096187CEDA78C9C1C021C294A0689198538"
137-
)[..],
138-
"Kupyna-256 did not produce the expected hash output"
132+
)[..]
139133
);
140134
}

0 commit comments

Comments
 (0)