golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.69k stars 17.49k forks source link

x/crypto/salsa20: implement cipher.Stream interface #25308

Open FiloSottile opened 6 years ago

FiloSottile commented 6 years ago

salsa20 is the odd one out that implements only a stateless XORKeyStream at the package level.

as commented 6 years ago

The nonce is currently exposed to the user, how would the cipher.Stream interface modify the nonce? simple increment?

How does the constructor handle the semantics for the different salsa lengths?

jannson commented 5 years ago

I implement an example here: https://github.com/jannson/salsa20stream

You can read usage in example: ver1: https://github.com/jannson/salsa20stream/blob/master/salsa20stream_test.go#L15 ver2: https://github.com/jannson/salsa20stream/blob/master/salsa20stream_test.go#L29

bench comparing with aes also in tests.