Skip to content

Commit b87432b

Browse files
committed
docs/uhashlib: Deconditionalize.
Notes on WiPy incompatibilities with the standard module API are moved under "Known issues" to its documentation.
1 parent 2e58474 commit b87432b

File tree

2 files changed

+20
-30
lines changed

2 files changed

+20
-30
lines changed

docs/library/uhashlib.rst

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,6 @@ Constructors
3737

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

40-
.. only:: port_wipy
41-
42-
.. class:: uhashlib.sha1([data[, block_size]])
43-
44-
Create a sha1 hasher object and optionally feed ``data`` or ``data and block_size`` into it.
45-
46-
.. class:: uhashlib.sha256([data[, block_size]])
47-
48-
Create a sha256 hasher object and optionally feed ``data`` or ``data and block_size`` into it.
49-
50-
.. admonition:: CPython extension
51-
:class: attention
52-
53-
Due to hardware implementation details of the WiPy, data must be buffered before being
54-
digested, which would make it impossible to calculate the hash of big blocks of data that
55-
do not fit in RAM. In this case, since most likely the total size of the data is known
56-
in advance, the size can be passed to the constructor and hence the HASH hardware engine
57-
of the WiPy can be properly initialized without needing buffering. If ``block_size`` is
58-
to be given, an initial chunk of ``data`` must be passed as well. **When using this extension,
59-
care must be taken to make sure that the length of all intermediate chunks (including the
60-
initial one) is a multiple of 4 bytes.** The last chunk may be of any length.
61-
62-
Example::
63-
64-
hash = uhashlib.sha1('abcd1234', 1001) # length of the initial piece is multiple of 4 bytes
65-
hash.update('1234') # also multiple of 4 bytes
66-
...
67-
hash.update('12345') # last chunk may be of any length
68-
hash.digest()
69-
7040
Methods
7141
-------
7242

docs/wipy/general.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,23 @@ SSL sockets need to be created the following way before wrapping them with.
253253
import ssl
254254
s = socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_SEC)
255255
ss = ssl.wrap_socket(s)
256+
257+
Incompatibilities in uhashlib module
258+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259+
260+
Due to hardware implementation details of the WiPy, data must be buffered before being
261+
digested, which would make it impossible to calculate the hash of big blocks of data that
262+
do not fit in RAM. In this case, since most likely the total size of the data is known
263+
in advance, the size can be passed to the constructor and hence the HASH hardware engine
264+
of the WiPy can be properly initialized without needing buffering. If ``block_size`` is
265+
to be given, an initial chunk of ``data`` must be passed as well. **When using this extension,
266+
care must be taken to make sure that the length of all intermediate chunks (including the
267+
initial one) is a multiple of 4 bytes.** The last chunk may be of any length.
268+
269+
Example::
270+
271+
hash = uhashlib.sha1('abcd1234', 1001) # length of the initial piece is multiple of 4 bytes
272+
hash.update('1234') # also multiple of 4 bytes
273+
...
274+
hash.update('12345') # last chunk may be of any length
275+
hash.digest()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy