diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-11-27 08:48:53 -0600 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-11-27 08:48:53 -0600 |
commit | bb30eb160045181b0c91fc9f2d8f374d65c2c13b (patch) | |
tree | 46009a3261034571d1549f36f5c5d196cbd2f7a7 /docs/hazmat/primitives/cryptographic-hashes.rst | |
parent | 3c25f61c18c6f8f9a2210fb2124654023bcec775 (diff) | |
parent | e60e1d782cb7c1abe68811092f7db342ed14b81f (diff) | |
download | cryptography-bb30eb160045181b0c91fc9f2d8f374d65c2c13b.tar.gz cryptography-bb30eb160045181b0c91fc9f2d8f374d65c2c13b.tar.bz2 cryptography-bb30eb160045181b0c91fc9f2d8f374d65c2c13b.zip |
Merge branch 'master' into validate-iv
Conflicts:
tests/hazmat/primitives/test_block.py
Diffstat (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst')
-rw-r--r-- | docs/hazmat/primitives/cryptographic-hashes.rst | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index 52e87702..312d7e69 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -5,7 +5,7 @@ Message Digests .. currentmodule:: cryptography.hazmat.primitives.hashes -.. class:: Hash(algorithm) +.. class:: Hash(algorithm, backend) A cryptographic hash function takes an arbitrary block of data and calculates a fixed-size bit string (a digest), such that different data @@ -20,8 +20,9 @@ Message Digests .. doctest:: + >>> from cryptography.hazmat.bindings import default_backend >>> from cryptography.hazmat.primitives import hashes - >>> digest = hashes.Hash(hashes.SHA256()) + >>> digest = hashes.Hash(hashes.SHA256(), backend=default_backend()) >>> digest.update(b"abc") >>> digest.update(b"123") >>> digest.finalize() @@ -33,6 +34,14 @@ Message Digests upgrading the hash algorithm you use over time. For more information, see `Lifetimes of cryptographic hash functions`_. + :param algorithm: A + :class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm` + provider such as those described in + :ref:`below <cryptographic-hash-algorithms>`. + :param backend: A + :class:`~cryptography.hazmat.bindings.interfaces.HashBackend` + provider. + .. method:: update(data) :param bytes data: The bytes you wish to hash. @@ -59,6 +68,8 @@ Message Digests :return bytes: The message digest as bytes. +.. _cryptographic-hash-algorithms: + SHA-1 ~~~~~ |