habnabit / cykeccak

Cython bindings to the Keccak sponge and SHA-3 functions
ISC License
4 stars 2 forks source link

Resuming sponges #1

Open knowitnothing opened 10 years ago

knowitnothing commented 10 years ago

Hello there, thanks for the package.

Is there any possibility of pausing/resuming sponges in the context of rng ?

If that's not clear, here's a complete example. Suppose you create a sponge s, absorbs data d, and then start squeezing it for rng purposes. At some time you decide to shutdown the program running it, and then later restart this same program. Would it be possible (only by extending the current cykeccak interface maybe?) to save that sponge such that after the program restarts, the squeezing continues from where it stopped ? Or, another possibilty, would it be possible to advance in the squeezing process without doing it manually ?

habnabit commented 10 years ago

Sure, I can make the state available for serialization and deserialization of sponges. It won't be hard.

What do you mean by "advance in the squeezing process without doing it manually" though? You want to be able to squeeze without getting the result as a string?

knowitnothing commented 10 years ago

That was an option I had in mind. The person could store the seed for the sponge and how many bits were squeezed, then later somehow she could advance it to a state where the same amount of bits were squeezed without needing to call squeeze for that amount of bits. But I don't know if this is possible (i.e. not storing the state) given how the sponge works.