rust-crypto icon indicating copy to clipboard operation
rust-crypto copied to clipboard

Seeking in Salsa20/ChaCha

Open passcod opened this issue 11 years ago • 3 comments

The wikipedia page states it is possible to "efficiently seek to any position in the output stream in constant time." This SO answer seems to indicate that the eSTREAM code uses an IV which contains both the nonce and the offset. The Salsa20 struct in rust-crypto has an offset field, but it is not accessible through normal functions (although I suppose one could initialise the struct oneself with a custom offset).

Am I missing something or is seeking not directly/easily possible when using this library?

passcod avatar Nov 27 '14 04:11 passcod

Its not currently possible, although I believe that constructing a new Salsa20 struct with a different offset would work. I'd certainly be happy to accept a patch to add this functionality - no one has gotten around to doing it quite yet, though.

DaGenix avatar Dec 06 '14 07:12 DaGenix

Seeking is also very useful for parallel processing

the8472 avatar Dec 04 '16 16:12 the8472

I've found that https://peterreid.github.io/chacha/chacha/index.html provides some desirable features:

  • in-place XOR
  • seeking
  • various nonce and block counter size tradeoffs

the8472 avatar Dec 30 '16 18:12 the8472