uhashlib – hashing algorithms

This module implements a subset of the corresponding CPython module, as described below. For more information, refer to the original CPython documentation: hashlib.

This module implements binary data hashing algorithms. The exact inventory of available algorithms depends on a board. RI5 implements:

  • SHA256 - The current generation, modern hashing algorithm (of SHA2 series). It is suitable for cryptographically-secure purposes.

Constructors

class uhashlib.sha256([data])

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

Difference for RI5

Classes sha1 and md5 from the base MicroPython version are not implemented on the RI5.

Methods

hash.update(data)

Feed more binary data into hash.

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.

hash.hexdigest()

This method is NOT implemented. Use ubinascii.hexlify(hash.digest()) to achieve a similar effect.