From 3da91cf3a28aaebb949a27a54b895596d6ea2ec2 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 11 Jun 2023 12:01:05 -0300 Subject: [PATCH] Fix random.random Whoops. --- ccryptolib/random.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccryptolib/random.lua b/ccryptolib/random.lua index 65656f2..f667ad1 100644 --- a/ccryptolib/random.lua +++ b/ccryptolib/random.lua @@ -40,7 +40,7 @@ end local function random(len) expect(1, len, "number") lassert(initialized, "attempt to use an uninitialized random generator", 2) - local msg = ("\0"):rep(math.min(len, 0) + 32) + local msg = ("\0"):rep(math.max(len, 0) + 32) local nonce = ("\0"):rep(12) local out = chacha20.crypt(state, nonce, msg, 8, 0) state = out:sub(1, 32)