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 store/restore functionality to digest::Context #2053

Open
anatse opened this issue May 8, 2024 · 2 comments
Open

Add store/restore functionality to digest::Context #2053

anatse opened this issue May 8, 2024 · 2 comments

Comments

@anatse
Copy link

anatse commented May 8, 2024

For some cases, such as compute hash sum for very big data passed through the HTTP streams, it is necessary to store and restore digest context. Our case: we are have storage which provides HTTP API to download with resume, using ranges. And this storage provides SHA_XXX hash sum for whole provided data, not for part. Therefore it need to check integrity for all data at the end of stream. In most cases it is not possible to complete the operation in one session, in cause to network errors. And compute whole hash sum using ring impossible because Context cannot be restored from pervious session. We also cannot see whole data at a time because we are acts just as a proxy and target system also not provides as a hash sum.

@anatse anatse changed the title Add functional store/restore to digest::Context Add functionality store/restore to digest::Context May 8, 2024
@anatse anatse changed the title Add functionality store/restore to digest::Context Add store/restore functionality to digest::Context May 8, 2024
@briansmith
Copy link
Owner

I don't have a problem with adding this, but I don't have cycles to do the work on it, so somebody would need to contribute it.

  • The format of the internal state should be opaque to the API. The API should export/import a slice of bytes. This means we need to pick an endianness for the bytes. I suggest little endian, since that's less work for most targets.
  • We shouldn't try to serialize digest::Algorithm or ``digest::AlgorithmId. Instead the user should pass in the &digest::Algorithm`. The user will need to be responsible for keeping track of what algorithm goes to which bytes.
  • The APIs should be named "....less_safe()`.
  • We should have tests that exercise every algorithm, in the same style as the existing digest tests.

@anatse
Copy link
Author

anatse commented May 27, 2024

PR - #2081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants