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 95eb1e9 commit 654e008Copy full SHA for 654e008
crypto/ChaCha20.py
@@ -118,4 +118,17 @@ def encrypt(self, plaintext: bytes) -> bytes:
118
"""
119
return self._apply_keystream(plaintext)
120
121
-
+ def decrypt(self, ciphertext: bytes) -> bytes:
122
+ """
123
+ Decrypts the given ciphertext using the ChaCha20 stream cipher.
124
+
125
+ Since ChaCha20 uses XOR for encryption, decryption is performed
126
+ using the same keystream and XOR operation.
127
128
+ Args:
129
+ ciphertext (bytes): The ciphertext data to be decrypted.
130
131
+ Returns:
132
+ bytes: The resulting plaintext.
133
134
+ return self.apply_keystream(ciphertext)
0 commit comments