We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bf8840 commit 8541ed6Copy full SHA for 8541ed6
crypto/tests/test_chacha20.py
@@ -24,3 +24,19 @@ def test_invalid_key_size():
24
assert "Key must be exactly 32 bytes" in str(e)
25
else:
26
assert False, "ValueError was not raised for long key"
27
+
28
+def test_invalid_nonce_size():
29
+ """Test invalid nonce sizes."""
30
+ try:
31
+ ChaCha20(VALID_KEY, b"short")
32
+ except ValueError as e:
33
+ assert "Nonce must be exactly 12 bytes" in str(e)
34
+ else:
35
+ assert False, "ValueError was not raised for short nonce"
36
37
38
+ ChaCha20(VALID_KEY, b"A" * 13)
39
40
41
42
+ assert False, "ValueError was not raised for long nonce"
0 commit comments