Skip to content

Get CRC Hash from S2 Header #782

Answered by klauspost
darthShadow asked this question in Q&A
Discussion options

You must be logged in to vote

For S2 (and Snappy) a block doesn't have any checksums or content validation.

On a Stream, each block is written with a checksum, that is a CRC32C, that is shifted: https://github.com/klauspost/compress/blob/master/s2/s2.go#L112-L117

This means that checksums here only represents each block, and you cannot get the total stream CRC.

If you just want a checksum and not a specific one, you could read read the stream and combine the checksums.

The framing format is the same as Snappy framing format, except S2 has a different stream identifier.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@darthShadow
Comment options

Answer selected by darthShadow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #781 on March 17, 2023 07:50.