diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-12-02 00:52:41 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-12-02 00:53:19 +0200 |
commit | d96a9164052a86927ddd2a5b39a8d5a357f01fc3 (patch) | |
tree | 96795fdca7bbf69e5af39617e4d0feff8cbf0cc3 | |
parent | 7f0699eedf95142e170148d9cc493d9a57eb4739 (diff) | |
download | micropython-d96a9164052a86927ddd2a5b39a8d5a357f01fc3.tar.gz micropython-d96a9164052a86927ddd2a5b39a8d5a357f01fc3.zip |
docs: Add quick docs for uhashlib.
-rw-r--r-- | docs/library/index.rst | 1 | ||||
-rw-r--r-- | docs/library/uhashlib.rst | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/docs/library/index.rst b/docs/library/index.rst index 81cae65a7d..aba69d28b4 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -38,6 +38,7 @@ it will fallback to loading the built-in ``ujson`` module. .. toctree:: :maxdepth: 1 + uhashlib.rst uheapq.rst ujson.rst usocket.rst diff --git a/docs/library/uhashlib.rst b/docs/library/uhashlib.rst new file mode 100644 index 0000000000..708e3d7bc9 --- /dev/null +++ b/docs/library/uhashlib.rst @@ -0,0 +1,37 @@ +:mod:`uhashlib` -- hashing algorithm +==================================== + +.. module:: uhashlib + :synopsis: hashing algorithm + +This module implements binary data hashing algorithms. Currently, it +implements SHA256 algorithm. Choosing SHA256 was a deliberate choice, +as a modern, cryptographically secure algorithm. This means that a +single algorithm can cover both usecases of "any hash algorithm" and +security-related usage, and thus save space omitting legacy algorithms +like MD5 or SHA1. + +Constructors +------------ + +.. class:: uhashlib.sha256([data]) + + Create a hasher object and optionally feed ``data`` into it. + + +Methods +------- + +.. method:: sha256.update(data) + + Feed more binary data into hash. + +.. method:: sha256.digest() + + Return hash for all data passed thru hash, as a bytes object. After this + method is called, more data cannot be fed into hash any longer. + +.. method:: sha256.hexdigest() + + This method is NOT implemented. Use ``ubinascii.hexlify(sha256.digest())`` + to achieve similar effect. |