Skip to content

Commit 2dcf168

Browse files
committed
Provide a couple examples of hexdigest
1 parent a7bd941 commit 2dcf168

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

zarr/core.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,19 @@ def bytestr(n):
18401840
def hexdigest(self, hashname="sha1"):
18411841
"""
18421842
Compute a checksum for the data. Default uses sha1 for speed.
1843+
1844+
Examples
1845+
--------
1846+
>>> import zarr
1847+
>>> z = zarr.empty(shape=(10000, 10000), chunks=(1000, 1000))
1848+
>>> z.hexdigest()
1849+
'041f90bc7a571452af4f850a8ca2c6cddfa8a1ac'
1850+
>>> z = zarr.zeros(shape=(10000, 10000), chunks=(1000, 1000))
1851+
>>> z.hexdigest()
1852+
'7162d416d26a68063b66ed1f30e0a866e4abed60'
1853+
>>> z = zarr.zeros(shape=(10000, 10000), dtype="u1", chunks=(1000, 1000))
1854+
>>> z.hexdigest()
1855+
'cb387af37410ae5a3222e893cf3373e4e4f22816'
18431856
"""
18441857

18451858
h = hashlib.new(hashname)

0 commit comments

Comments
 (0)