Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Functions to Read and Write dcz Headers #4272

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

felixhandte
Copy link
Contributor

@felixhandte felixhandte commented Jan 28, 2025

This PR adds support to Zstd for handling the header used by the dcz HTTP Content-Encoding, described in draft-ietf-httpbis-compression-dictionary.

To-Do:

  • SHA-256 Impl.
  • SHA-256 Tests.
  • User API.
  • User API Impl.
  • User API Tests.
  • CLI Support.
  • CLI Tests.

They say "never roll your own crypto" but... they hate us cuz they ain't us.
This commit adds a very simple implementation of the SHA-256 hashing
algorithm. This implementation is constructed in part by reference to the
specification[0] and in part by looking at how some other single-file
implementations work.

This commit also adds a little test program that validates that our
implementation passes all of the NIST test vectors. So it's probably correct!

[0] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
I guess the kernel binding's version of `zstd_deps.h` will need to be updated
to add a `ZSTD_memcmp()` define.
@felixhandte felixhandte force-pushed the dcz-sha-skippable-frame branch from 7190186 to eefd670 Compare January 28, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants