Make ChaCha20 tests a bit more didactic.

This commit is contained in:
Milan Špinka
2025-01-27 03:15:48 +01:00
parent 78d2503392
commit fd2fbabca9

View File

@ -287,11 +287,11 @@ test "ChaCha Quarter Round" {
// https://www.rfc-editor.org/rfc/rfc7539#section-2.3.2
test "ChaCha20 Block Function" {
const key = [_]u8{
const key = [CHACHA20_KEY_SIZE]u8{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
};
const nonce = [_]u8{
const nonce = [ChaCha20_RFC7539_Parameters.NONCE_SIZE]u8{
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00,
};
@ -344,3 +344,7 @@ test "ChaCha20 Cipher" {
try chacha20_encrypt_inplace(&chacha, &buffer);
try testing.expectEqualSlices(u8, reference[0..], buffer[0..]);
}
test "ChaCha20 counter increment edge cases" {
// TODO: test
}