aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/cryptographic-hashes.rst
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-26 09:31:06 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-26 09:31:06 -0800
commite60e1d782cb7c1abe68811092f7db342ed14b81f (patch)
tree555ed6a8cecd2759fd22dfbb41f6d61fd46b7788 /docs/hazmat/primitives/cryptographic-hashes.rst
parent90501724c5b3d73fea5a4242fa09c32277c6c210 (diff)
parent6dc73a9bd475dfb7a3c18c65afaeb644cce3749f (diff)
downloadcryptography-e60e1d782cb7c1abe68811092f7db342ed14b81f.tar.gz
cryptography-e60e1d782cb7c1abe68811092f7db342ed14b81f.tar.bz2
cryptography-e60e1d782cb7c1abe68811092f7db342ed14b81f.zip
Merge pull request #227 from dreid/explicit-backend-in-hazmat
Explicit backend
Diffstat (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst')
-rw-r--r--docs/hazmat/primitives/cryptographic-hashes.rst15
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
~~~~~