Skip to content

Commit 4825a1d

Browse files
committed
Add docs
1 parent dbbf2bc commit 4825a1d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

docs/checksum32.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ Adler32
2222
.. automethod:: decode
2323
.. automethod:: get_config
2424
.. automethod:: from_config
25+
26+
27+
Fletcher32
28+
----------
29+
30+
.. autoclass:: numcodecs.fletcher32.Fletcher32
31+
32+
.. autoattribute:: codec_id
33+
.. automethod:: encode
34+
.. automethod:: decode
35+

docs/release.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Unreleased
1515
Enhancements
1616
~~~~~~~~~~~~
1717

18-
*
18+
* Add ``fletcher32`` checksum codec
19+
By :user:`Martin Durant <martindurant>`, :issue:`410`.
1920

2021
Fix
2122
~~~

numcodecs/fletcher32.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ from libc.stdint cimport uint8_t, uint16_t, uint32_t
1010

1111

1212
cdef uint32_t _fletcher32(const uint8_t[::1] _data):
13+
# converted from
14+
# https://github.com/Unidata/netcdf-c/blob/main/plugins/H5checksum.c#L109
1315
cdef:
1416
const uint8_t *data = &_data[0]
1517
size_t _len = _data.shape[0]
@@ -46,6 +48,10 @@ cdef uint32_t _fletcher32(const uint8_t[::1] _data):
4648
class Fletcher32(Codec):
4749
"""The fletcher checksum with 16-bit words and 32-bit output
4850
51+
This is the netCDF4/HED5 implementation, which is not equivalent
52+
to the one in wikipedia
53+
https://github.com/Unidata/netcdf-c/blob/main/plugins/H5checksum.c#L95
54+
4955
With this codec, the checksum is concatenated on the end of the data
5056
bytes when encoded. At decode time, the checksum is performed on
5157
the data portion and compared with the four-byte checksum, raising

0 commit comments

Comments
 (0)