Add stream_xor(); deprecate encrypt/decrypt_unauthenticated
release / build-wheels (linux, bash) (push) Failing after 15s
release / build-wheels (windows, cmd) (push) Failing after 1m14s
release / build-wheels (macos, bash) (push) Failing after 18s
release / publish-pypi (push) Skipped

Following upstream libaegis 0.10.5 (874f884): the absorbing-mode
unauthenticated pair is deprecated in favor of the pure keystream XOR.
- stream_xor(key, nonce, data, into=None): same function encrypts and
  decrypts; output equals data XOR stream(key, nonce); supports in-place
  use via into (same buffer semantics as elsewhere).
- encrypt_unauthenticated/decrypt_unauthenticated kept for the old
  format but now emit DeprecationWarning; removed from README (stream_xor
  documented under Keystream generation instead).
This commit is contained in:
LeoVasanko committed 2026-10-04 15:57:28 +00:00
1 parent 9d36d3b81b
commit 1eb0b6e8c0
9 files changed
+492 -7

No files matched your search

+2 -5
View File
@@ -79,10 +79,6 @@ The MAC tag is handled separately of ciphertext:
- encrypt_detached(key, nonce, message, ad=None, maclen=16, ct_into=None, mac_into=None) -> (ct, mac)
- decrypt_detached(key, nonce, ct, mac, ad=None, into=None) -> plaintext
No MAC tag, vulnerable to alterations:
- encrypt_unauthenticated(key, nonce, message, into=None) -> ciphertext (testing only)
- decrypt_unauthenticated(key, nonce, ct, into=None) -> plaintext (testing only)
### Incremental AEAD
Stateful classes that can be used for processing the data in separate chunks:
@@ -116,6 +112,7 @@ The `Mac` class follows the Python hashlib API for compatibility with code expec
Useful for creating pseudo random bytes as rapidly as possible. Reuse of the same (key, nonce) creates identical output.
- stream(key, nonce=None, length=None, into=None) -> randombytes
- stream_xor(key, nonce, data, into=None) -> data XOR keystream (unauthenticated; encrypts and decrypts)
### Miscellaneous
@@ -311,7 +308,7 @@ pt = ciph.decrypt(key, nonce, ct, into=buf)
print(bytes(pt))
```
Detached and unauthenticated modes can use same size input and output (no MAC added to ciphertext). Detached encryption instead of `into` takes `ct_into` and `mac_into` separately and returns memoryviews to both.
Detached mode can use same size input and output (no MAC added to ciphertext). Detached encryption instead of `into` takes `ct_into` and `mac_into` separately and returns memoryviews to both.
## Performance