Checksum codecs#
CRC32#
- class numcodecs.checksum32.CRC32(location: Literal['start', 'end'] | None = None)[source]#
Codec add a crc32 checksum to the buffer.
- Parameters:
- location‘start’ or ‘end’
Where to place the checksum in the buffer.
- codec_id: str | None = 'crc32'#
Codec identifier.
- encode(buf)#
Encode data in buf.
- Parameters:
- bufbuffer-like
Data to be encoded. May be any object supporting the new-style buffer protocol.
- Returns:
- encbuffer-like
Encoded data. May be any object supporting the new-style buffer protocol.
- decode(buf, out=None)#
Decode data in buf.
- Parameters:
- bufbuffer-like
Encoded data. May be any object supporting the new-style buffer protocol.
- outbuffer-like, optional
Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.
- Returns:
- decbuffer-like
Decoded data. May be any object supporting the new-style buffer protocol.
- get_config()#
Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.
- classmethod from_config(config)#
Instantiate codec from a configuration object.
CRC32C#
- class numcodecs.checksum32.CRC32C(location: Literal['start', 'end'] | None = None)[source]#
Codec add a crc32c checksum to the buffer.
- Parameters:
- location‘start’ or ‘end’
Where to place the checksum in the buffer.
- codec_id: str | None = 'crc32c'#
Codec identifier.
- encode(buf)#
Encode data in buf.
- Parameters:
- bufbuffer-like
Data to be encoded. May be any object supporting the new-style buffer protocol.
- Returns:
- encbuffer-like
Encoded data. May be any object supporting the new-style buffer protocol.
- decode(buf, out=None)#
Decode data in buf.
- Parameters:
- bufbuffer-like
Encoded data. May be any object supporting the new-style buffer protocol.
- outbuffer-like, optional
Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.
- Returns:
- decbuffer-like
Decoded data. May be any object supporting the new-style buffer protocol.
- get_config()#
Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.
- classmethod from_config(config)#
Instantiate codec from a configuration object.
Adler32#
- class numcodecs.checksum32.Adler32(location: Literal['start', 'end'] | None = None)[source]#
Codec add a adler32 checksum to the buffer.
- Parameters:
- location‘start’ or ‘end’
Where to place the checksum in the buffer.
- codec_id: str | None = 'adler32'#
Codec identifier.
- encode(buf)#
Encode data in buf.
- Parameters:
- bufbuffer-like
Data to be encoded. May be any object supporting the new-style buffer protocol.
- Returns:
- encbuffer-like
Encoded data. May be any object supporting the new-style buffer protocol.
- decode(buf, out=None)#
Decode data in buf.
- Parameters:
- bufbuffer-like
Encoded data. May be any object supporting the new-style buffer protocol.
- outbuffer-like, optional
Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.
- Returns:
- decbuffer-like
Decoded data. May be any object supporting the new-style buffer protocol.
- get_config()#
Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.
- classmethod from_config(config)#
Instantiate codec from a configuration object.
Fletcher32#
- class numcodecs.fletcher32.Fletcher32#
The fletcher checksum with 16-bit words and 32-bit output
This is the netCDF4/HED5 implementation, which is not equivalent to the one in wikipedia Unidata/netcdf-c
With this codec, the checksum is concatenated on the end of the data bytes when encoded. At decode time, the checksum is performed on the data portion and compared with the four-byte checksum, raising RuntimeError if inconsistent.
- codec_id: str | None = 'fletcher32'#
Codec identifier.
- encode(buf)#
Return buffer plus 4-byte fletcher checksum
- decode(buf, out=None)#
Check fletcher checksum, and return buffer without it
JenkinsLookup3#
- class numcodecs.checksum32.JenkinsLookup3(initval: int = 0, prefix=None)[source]#
Bob Jenkin’s lookup3 checksum with 32-bit output
This is the HDF5 implementation. HDFGroup/hdf5
With this codec, the checksum is concatenated on the end of the data bytes when encoded. At decode time, the checksum is performed on the data portion and compared with the four-byte checksum, raising RuntimeError if inconsistent.
- Parameters:
- initvalint
initial seed passed to the hash algorithm, default: 0
- prefixint
bytes prepended to the buffer before evaluating the hash, default: None
- codec_id: str | None = 'jenkins_lookup3'#
Codec identifier.
- initval#
- prefix#