You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A random nonce is generated for each encryption unless you specify one.
75
77
76
78
Args:
77
-
key: A 32-byte ChaCha20Poly1305 key.
79
+
key: A 32-byte XChaCha20Poly1305 key.
78
80
plaintext: Data to encrypt.
81
+
nonce: An (optional) nonce to be used.
79
82
counter: an (optional) number to add to nonce
80
-
83
+
counter_safety: an (optional) max counter number, to prevent counter overflow.
84
+
max_padding: an (optional) maximum padding limit number to message. Cannot be larger than what `XCHACHA20POLY1305_MAX_RANODM_PAD` could store. Set to 0 for no padding.
81
85
Returns:
82
86
A tuple (nonce, ciphertext) where:
83
-
- nonce: The randomly generated AES-GCM nonce.
87
+
- nonce: The randomly generated nonce or the same given nonce.
84
88
- ciphertext: The encrypted data including the authentication tag.
0 commit comments