:py:mod:`pylibressl.digest` =========================== .. py:module:: pylibressl.digest .. autoapi-nested-parse:: Message digests Usage example: >>> from pylibressl.digest import SHA512 >>> >>> data = b'Some binary data' >>> hash = SHA512() >>> hash_value = hash.update(data).digest() >>> >>> # Other possible form: >>> # hash_value = SHA512(data).digest() Note that you cannot call ``update()`` after ``digest()`` for the same hash instance. Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 digest/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: pylibressl.digest.Streebog512 pylibressl.digest.SHA512 pylibressl.digest.SHA256 pylibressl.digest.BaseHash .. py:class:: Streebog512(data=None) Bases: :py:obj:`BaseHash` Streebog (GOST R 34.11.2012) hash. .. py:attribute:: _HASH_ID .. py:class:: SHA512(data=None) Bases: :py:obj:`BaseHash` SHA512 hash. .. py:attribute:: _HASH_ID .. py:class:: SHA256(data=None) Bases: :py:obj:`BaseHash` Generic hash object. When implementing a digest, `_HASH_ID` should be set to appropriate EVP_MD* using LibreSSL EVP functions. .. py:attribute:: _HASH_ID .. py:class:: BaseHash(data=None) Bases: :py:obj:`object` Generic hash object. When implementing a digest, `_HASH_ID` should be set to appropriate EVP_MD* using LibreSSL EVP functions. .. py:attribute:: _HASH_ID .. py:method:: update(self, data) Append more data to digest. Should not be called after ``digest()`` call. Otherwise, ``DigestReuseError`` is raised. .. py:method:: digest(self) Show digest as a byte string. .. py:method:: size(cls) :classmethod: Return size of digest in bytes. .. py:method:: block_size(cls) :classmethod: Return block size of digest in bytes. .. py:method:: max_size(cls) :classmethod: Maximum hash size supported by LibreSSL.