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

sha2: Interested in a way to save/restore internal state #522

Closed
wkatsak opened this issue Dec 15, 2023 · 1 comment
Closed

sha2: Interested in a way to save/restore internal state #522

wkatsak opened this issue Dec 15, 2023 · 1 comment

Comments

@wkatsak
Copy link

wkatsak commented Dec 15, 2023

Hello,

This is not an issue per say, more of a question that requires expertise in this library to answer.

I am interested in modifying the sha2 hasher (in particular, for sha256) such that, after some number of bytes have already been added (via .update()), I could save the state of the hasher (for sha256, of course, this is just the 32 bytes of state), then create a new hasher object later with the same starting state.

The use case is a situation where the chunks of data become available on a variable timeline (could be seconds, days, or hours in between arrivals), and rather than perform one big hash operation at the end (once all data has arrived), I would prefer to amortize these operations across the individual arrival events.

It is not feasible to keep this state in memory between arrivals, it would need to be saved to a backing store.

I've already drilled down into the code and understand where the state is kept. Still, it isn't clear to me what would be the path of least resistance to plumb the state back up through the VariableOutputCore, CtVariableCoreWrapper, and CoreCrapper. Maybe a new set of traits would make sense?

I have no issue doing the work and would publish it for anyone else interested, but I am hoping for some informed guidance.

Thanks very much in advance.

Sincerely,
Bill

@tarcieri
Copy link
Member

It's a work-in-progress. See: RustCrypto/traits#1369

Also: #310

Closing this as a duplicate.

@tarcieri tarcieri closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2023
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