diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-02-13 12:49:27 -0500 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-02-13 12:49:27 -0500 |
commit | 0f696fab0e012bca0b69f2c933c679f5ecbe80ad (patch) | |
tree | 96d5ed3979e735548b0e3ec6a59f5017d820526b /docs/hazmat/primitives/cryptographic-hashes.rst | |
parent | 723cc3f2ed921c01168ea8f35ca7e94f2cc0a44b (diff) | |
parent | 2636e4abd54140a26cf8f0793d1be16d9458e032 (diff) | |
download | cryptography-0f696fab0e012bca0b69f2c933c679f5ecbe80ad.tar.gz cryptography-0f696fab0e012bca0b69f2c933c679f5ecbe80ad.tar.bz2 cryptography-0f696fab0e012bca0b69f2c933c679f5ecbe80ad.zip |
Merge pull request #1658 from reaperhulk/move-hash-interfaces
Move hash interfaces
Diffstat (limited to 'docs/hazmat/primitives/cryptographic-hashes.rst')
-rw-r--r-- | docs/hazmat/primitives/cryptographic-hashes.rst | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index c8b56eb9..49288326 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -12,9 +12,9 @@ Message digests results (with a high probability) in different digests. This is an implementation of - :class:`~cryptography.hazmat.primitives.interfaces.HashContext` meant to + :class:`~cryptography.hazmat.primitives.hashes.HashContext` meant to be used with - :class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm` + :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` implementations to provide an incremental interface to calculating various message digests. @@ -39,7 +39,7 @@ Message digests `Lifetimes of cryptographic hash functions`_. :param algorithm: A - :class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm` + :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` provider such as those described in :ref:`below <cryptographic-hash-algorithms>`. :param backend: A @@ -146,4 +146,48 @@ MD5 message digest and has practical known collision attacks. +Interfaces +~~~~~~~~~~ + +.. class:: HashAlgorithm + + .. attribute:: name + + :type: str + + The standard name for the hash algorithm, for example: ``"sha256"`` or + ``"whirlpool"``. + + .. attribute:: digest_size + + :type: int + + The size of the resulting digest in bytes. + + .. attribute:: block_size + + :type: int + + The internal block size of the hash algorithm in bytes. + + +.. class:: HashContext + + .. attribute:: algorithm + + A :class:`HashAlgorithm` that will be used by this context. + + .. method:: update(data) + + :param bytes data: The data you want to hash. + + .. method:: finalize() + + :return: The final digest as bytes. + + .. method:: copy() + + :return: A :class:`HashContext` that is a copy of the current context. + + .. _`Lifetimes of cryptographic hash functions`: http://valerieaurora.org/hash.html |