From adea3dd83f2a601d59a165865890d02dc9b36b00 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Wed, 11 Feb 2026 23:39:47 +0100 Subject: [PATCH] Fix chacha20 --- test/unit/stdlib/crypto/chacha20.c3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/stdlib/crypto/chacha20.c3 b/test/unit/stdlib/crypto/chacha20.c3 index 9246d2104..b98d0fe64 100644 --- a/test/unit/stdlib/crypto/chacha20.c3 +++ b/test/unit/stdlib/crypto/chacha20.c3 @@ -431,7 +431,7 @@ fn void scrolling_input_unaligned_permutations_with_random_chunks() @if($feature ChaCha20 c @noinit; defer c.destroy(); c.init(key, nonce); - for (usz x = 1; encrypt_me.len; encrypt_me = encrypt_me[x..], x = (rand.next_byte() % min(k, encrypt_me.len ?: 1)) ?: 1) c.transform(encrypt_me[:x]); + for (usz x = 1; encrypt_me.len; encrypt_me = encrypt_me[x..], x = (rand.next_byte() % min(k, encrypt_me.len ?: 1U)) ?: 1U) c.transform(encrypt_me[:x]); test::@check(unaligned[i:j] == LARGE_EXPECTED[:j], "Mismatched permutation of hash on index (%d, %d; %d).", i, j, k); test::@check(chacha20::tencrypt(LARGE_INPUT[:j], key, nonce) == LARGE_EXPECTED[:j], "Mismatched permutation of hash on index (%d, %d).", i, j);