Skip to content

Commit d96a916

Browse files
committed
docs: Add quick docs for uhashlib.
1 parent 7f0699e commit d96a916

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

docs/library/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ it will fallback to loading the built-in ``ujson`` module.
3838
.. toctree::
3939
:maxdepth: 1
4040

41+
uhashlib.rst
4142
uheapq.rst
4243
ujson.rst
4344
usocket.rst

docs/library/uhashlib.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
:mod:`uhashlib` -- hashing algorithm
2+
====================================
3+
4+
.. module:: uhashlib
5+
:synopsis: hashing algorithm
6+
7+
This module implements binary data hashing algorithms. Currently, it
8+
implements SHA256 algorithm. Choosing SHA256 was a deliberate choice,
9+
as a modern, cryptographically secure algorithm. This means that a
10+
single algorithm can cover both usecases of "any hash algorithm" and
11+
security-related usage, and thus save space omitting legacy algorithms
12+
like MD5 or SHA1.
13+
14+
Constructors
15+
------------
16+
17+
.. class:: uhashlib.sha256([data])
18+
19+
Create a hasher object and optionally feed ``data`` into it.
20+
21+
22+
Methods
23+
-------
24+
25+
.. method:: sha256.update(data)
26+
27+
Feed more binary data into hash.
28+
29+
.. method:: sha256.digest()
30+
31+
Return hash for all data passed thru hash, as a bytes object. After this
32+
method is called, more data cannot be fed into hash any longer.
33+
34+
.. method:: sha256.hexdigest()
35+
36+
This method is NOT implemented. Use ``ubinascii.hexlify(sha256.digest())``
37+
to achieve similar effect.

0 commit comments

Comments
 (0)