Skip to content

Commit 8637d0c

Browse files
Remove extra trailing whitespace
1 parent d19ad9f commit 8637d0c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pydatastructs/crypto/tests/test_chacha20.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ def test_key_reuse_simple():
6464
"""
6565
Test the vulnerability of key reuse in ChaCha20 encryption.
6666
67-
This test demonstrates the security flaw of reusing the same key and nonce
68-
for different plaintexts in stream ciphers. It exploits the property that
69-
XORing two ciphertexts from the same keystream cancels out the keystream,
70-
revealing the XOR of the plaintexts.
67+
This test demonstrates the security flaw of reusing the same key and nonce
68+
for different plaintexts in stream ciphers. It exploits the property that
69+
XORing two ciphertexts from the same keystream cancels out the keystream,
70+
revealing the XOR of the plaintexts.
7171
7272
Encrypt two different plaintexts with the same key and nonce.
7373
XOR the resulting ciphertexts to remove the keystream, leaving only the XOR of plaintexts.
7474
XOR the result with the first plaintext to recover the second plaintext.
7575
Assert that the recovered plaintext matches the original second plaintext.
7676
7777
Expected Behavior:
78-
- If the ChaCha20 implementation is correct, reusing the same key and nonce
78+
- If the ChaCha20 implementation is correct, reusing the same key and nonce
7979
will expose the XOR relationship between plaintexts.
8080
- The test should successfully recover the second plaintext using XOR operations.
8181
8282
Assertion:
83-
- Raises an AssertionError if the recovered plaintext does not match the
83+
- Raises an AssertionError if the recovered plaintext does not match the
8484
original second plaintext, indicating a failure in the XOR recovery logic.
8585
8686
Output:
@@ -89,11 +89,11 @@ def test_key_reuse_simple():
8989
- Displays the XOR result (hexadecimal format) for inspection.
9090
9191
Security Note:
92-
- This test highlights why it is critical never to reuse the same key and nonce
92+
- This test highlights why it is critical never to reuse the same key and nonce
9393
in stream ciphers like ChaCha20.
9494
"""
9595

96-
96+
9797
cipher1 = ChaCha20(VALID_KEY, VALID_NONCE)
9898
cipher2 = ChaCha20(VALID_KEY, VALID_NONCE)
9999

0 commit comments

Comments
 (0)