hashlib – hashing algorithms¶
This module implements binary data hashing algorithms. Each algorithm is
exposed as a class whose instances accept incremental data via
update() and produce a fixed-size digest via digest(). The
exact inventory of available algorithms depends on the 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 interoperability will try to provide this.
MD5 - A legacy algorithm, not considered cryptographically secure. Only selected boards, targeting interoperability with legacy applications, will offer this.
Constructors¶
- class hashlib.sha256(data: bytes = b'')¶
Create an SHA256 hasher object and optionally feed
datainto it.
Methods¶
- class hashlib.hash¶
Hasher object returned by
hashlib.sha256(),hashlib.sha1(), orhashlib.md5().