Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
59 lines (38 loc) · 1.79 KB

File metadata and controls

59 lines (38 loc) · 1.79 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

:mod:`hashlib` -- hashing algorithms

.. module:: hashlib
   :synopsis: hashing algorithms

|see_cpython_module| :mod:`cpython:hashlib`.

This module implements binary data hashing algorithms. The exact inventory of available algorithms depends on a board. Among the algorithms which may be implemented:

  • SHA256 - The current generation, modern hashing algorithm (of SHA2 series). It is suitable for cryptographically-secure purposes. Included in the MicroPython core and any board is recommended to provide this, unless it has particular code size constraints.
  • SHA1 - A previous generation algorithm. Not recommended for new usages, but SHA1 is a part of number of Internet standards and existing applications, so boards targeting network connectivity and interoperatiability will try to provide this.
  • MD5 - A legacy algorithm, not considered cryptographically secure. Only selected boards, targeting interoperatibility with legacy applications, will offer this.

Constructors

Create an SHA256 hasher object and optionally feed data into it.

Create an SHA1 hasher object and optionally feed data into it.

Create an MD5 hasher object and optionally feed data into it.

Methods

.. method:: hash.update(data)

   Feed more binary data into hash.

.. method:: hash.digest()

   Return hash for all data passed through hash, as a bytes object. After this
   method is called, more data cannot be fed into the hash any longer.

.. method:: hash.hexdigest()

   This method is NOT implemented. Use ``binascii.hexlify(hash.digest())``
   to achieve a similar effect.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.