From ef0fcf26c920c011948f078481739f4e2c31535f Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 6 Nov 2013 11:12:45 -0800 Subject: Add a default_backend and start updating docs. --- docs/hazmat/primitives/cryptographic-hashes.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst') diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index 52e87702..b3db9f19 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 @@ -19,9 +19,9 @@ Message Digests various 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(), default_backend()) >>> digest.update(b"abc") >>> digest.update(b"123") >>> digest.finalize() -- cgit v1.2.3 From 846460ae25554cbf007c0b65f8d7997d543ea53e Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 6 Nov 2013 11:24:50 -0800 Subject: Fix doctests. --- docs/hazmat/primitives/cryptographic-hashes.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst') diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index b3db9f19..f05b45a5 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -19,6 +19,7 @@ Message Digests various message digests. .. doctest:: + >>> from cryptography.hazmat.bindings import default_backend >>> from cryptography.hazmat.primitives import hashes >>> digest = hashes.Hash(hashes.SHA256(), default_backend()) -- cgit v1.2.3 From 63fa19ace98c2c88a6065acc9e944a71480ff651 Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 20 Nov 2013 10:49:13 -0800 Subject: Use backend as keyword argument everywhere. --- docs/hazmat/primitives/cryptographic-hashes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst') diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index f05b45a5..92f8fa30 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -22,7 +22,7 @@ Message Digests >>> from cryptography.hazmat.bindings import default_backend >>> from cryptography.hazmat.primitives import hashes - >>> digest = hashes.Hash(hashes.SHA256(), default_backend()) + >>> digest = hashes.Hash(hashes.SHA256(), backend=default_backend()) >>> digest.update(b"abc") >>> digest.update(b"123") >>> digest.finalize() -- cgit v1.2.3 From 663295d015d4aa65258f14d91c6350726604350c Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 20 Nov 2013 13:55:08 -0800 Subject: Document all the parameters including cross references to specific providers where appropriate. --- docs/hazmat/primitives/cryptographic-hashes.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst') diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index 92f8fa30..312d7e69 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -34,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 `. + :param backend: A + :class:`~cryptography.hazmat.bindings.interfaces.HashBackend` + provider. + .. method:: update(data) :param bytes data: The bytes you wish to hash. @@ -60,6 +68,8 @@ Message Digests :return bytes: The message digest as bytes. +.. _cryptographic-hash-algorithms: + SHA-1 ~~~~~ -- cgit v1.2.3