Skip to content

Commit 4913b29

Browse files
committed
Update docs with dropping py2 and new bytes only interface
1 parent 31da322 commit 4913b29

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
## [2.0.0] - 2019-12-25
4+
5+
### Added
6+
* This Changelog
7+
* Type hints
8+
9+
### Changed
10+
* All crypto operations (encryption, decryption, tagging) now explicitly only operate on
11+
`bytes` arguments
12+
13+
### Removed
14+
* Python2.x and Python3.4 support
15+
* `utils` module now that interface is explicitly `bytes` arguments

README.rst

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,18 @@ by itself:
5151
from os import urandom
5252
5353
key = urandom(32) # key is 32 bytes
54-
nonce = 'thisisanonce' # nonce is 12 bytes (DO NOT REUSE A NONCE WITH THE SAME KEY)
55-
message = 'Some message to be encrypted'
56-
additional_data = 'Some additional data' # this will not be encrypted but will be verified for integrity
54+
nonce = b'thisisanonce' # nonce is 12 bytes (DO NOT REUSE A NONCE WITH THE SAME KEY)
55+
message = b'Some message to be encrypted'
56+
additional_data = b'Some additional data' # this will not be encrypted but will be verified for integrity
5757
5858
# encryption
5959
ciphertext, mac = aead.encrypt_and_tag(key, nonce, message, additional_data)
6060
6161
# decryption (which yields plaintext == message)
6262
plaintext = aead.verify_and_decrypt(key, nonce, ciphertext, mac, additional_data)
6363
64-
Notes on Python 2 vs 3
65-
----------------------
6664
67-
In python2 encryption and decryption and tagging will return :code:`str` data while in python3 they will return
68-
:code:`bytes` data. This is consistent with how much of the python library operates between the two versions (e.g.
69-
see :code:`binascii.unhexlify`). This can lead to some strange behavior if e.g. you encrypt a :code:`str` value in
70-
python3 and, after decrypting, your decrypted value does not match your original value because you got :code:`bytes`
71-
back from the decryption. If the returned type is undesirable it is of course always possible to convert between
72-
:code:`bytes` and :code:`str` as needed.
65+
Note that all operations in this package work on bytes. You'll need to call e.g. :code:`encode()` on strings
66+
before passing them as arguments.
7367

7468
.. _RFC7539: https://tools.ietf.org/html/rfc7539

0 commit comments

Comments
 (0)