dubek / salsa20-ruby

Ruby bindings for the Salsa20 stream cipher algorithm
Other
4 stars 1 forks source link

Does it support reduced-round (8-round and 12-round) variants of Salsa20? #1

Closed Juanchen1190 closed 6 years ago

Juanchen1190 commented 6 years ago

For some reason, I would like to use the 8-round variant of Salsa20, but I didn't know how to do this with this gem.

dubek commented 6 years ago

The gem doesn't support it as-is.

I think the only thing you need to modify is to change 20 to 8 (or 12) in this line: https://github.com/dubek/salsa20-ruby/blob/master/ext/salsa20_ext/salsa20.c#L106 and rebuild the gem locally (simply run rake from the project root directory).

But I can't easily find any test vectors for Salsa20/8 or Salsa20/12, so I'm not sure if that change is indeed the correct one.

Juanchen1190 commented 6 years ago

It works, thank you very much.