diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-02-12 11:48:57 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-02-12 11:48:57 -0800 |
commit | cca5d52d3c4c4e3e6fd1c9c110fb5a4dad3bbf48 (patch) | |
tree | 4548381143df1eb28ad89e84caddd7c870aabe7c /docs/hazmat/primitives | |
parent | ba657d3856554ba81fad4cf83acd723ab7f3bee9 (diff) | |
parent | 50309fb75a51fbad14dc7f33d8ca1b39aea73463 (diff) | |
download | cryptography-cca5d52d3c4c4e3e6fd1c9c110fb5a4dad3bbf48.tar.gz cryptography-cca5d52d3c4c4e3e6fd1c9c110fb5a4dad3bbf48.tar.bz2 cryptography-cca5d52d3c4c4e3e6fd1c9c110fb5a4dad3bbf48.zip |
Merge pull request #601 from dreid/confusing-padding-example
Don't throw away the result of padder.update because it confuses users.
Diffstat (limited to 'docs/hazmat/primitives')
-rw-r--r-- | docs/hazmat/primitives/padding.rst | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/docs/hazmat/primitives/padding.rst b/docs/hazmat/primitives/padding.rst index da5a95dd..83154c0d 100644 --- a/docs/hazmat/primitives/padding.rst +++ b/docs/hazmat/primitives/padding.rst @@ -23,16 +23,18 @@ multiple of the block size. >>> from cryptography.hazmat.primitives import padding >>> padder = padding.PKCS7(128).padder() - >>> padder.update(b"1111111111") - '' - >>> padded_data = padder.finalize() + >>> padded_data = padder.update(b"11111111111111112222222222") >>> padded_data - '1111111111\x06\x06\x06\x06\x06\x06' + '1111111111111111' + >>> padded_data += padder.finalize() + >>> padded_data + '11111111111111112222222222\x06\x06\x06\x06\x06\x06' >>> unpadder = padding.PKCS7(128).unpadder() - >>> unpadder.update(padded_data) - '' - >>> unpadder.finalize() - '1111111111' + >>> data = unpadder.update(padded_data) + >>> data + '1111111111111111' + >>> data + unpadder.finalize() + '11111111111111112222222222' :param block_size: The size of the block in bits that the data is being padded to. |