Skip to content

XSalsa20, ChaCha, Faster + Reduced Round Salsa20 #20

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

Closed
wants to merge 9 commits into from

Conversation

timw
Copy link
Contributor

@timw timw commented Jul 6, 2013

This is a series of evolutions of the Salsa20 engine family, basically presented as I developed them.
If you want to cherry-pick or rework (e.g. to not be based on extending Salsa20 engine) feel free.


XSalsa20 implementation, based on the existing Salsa20 engine with a couple of tweaks to allow the key setup and nonce size to vary

XSalsa20 is a version of the Salsa20 stream cipher with an extended (192 vs 64 bit) nonce.

Test vectors are copied from the cryptopp implementation, which were generated using the nacl XSalsa20. There don't appear to be any official test vectors.


ChaCha implementation, based on the existing Salsa20 engine with the key setup, block permutation and block counter increment overridden.

This is basically an implementation of the 'regs' reference implementation found in the eStream benchmark suite and at http://cr.yp.to/chacha.html.

Speed is slightly (~10% faster) than the Salsa20 engine (due to the registerization).


Reduced round Salsa20

Parameterisation of Salsa20Engine to allow arbitrary rounds. Test vectors from estreambench-20080905.


Registerization of Salsa20Engine

Registerize the state variables in salsa20Core to allow Hotspot etc. to optimise the loads/stores (as much as can be done with 16 variables and no SIMD).
Boosts performance by about 10% on common x86 hardware, possibly more on setups with more registers. Should have no affect on systems with small numbers of registers.

timw and others added 9 commits July 6, 2013 20:53
Salsa20Engine is refactored slightly to allow XSalsa20Engine to override key setup, algorithm name and nonce size.

XSalsa20 test vectors copied from CryptoPP (which generated them using nacl xsalsa20 implementation).
Test vectors generated with the reference implementations in estreambench-20080905.
…y setup, block counter and state permutation.
Standard 20 round, and reduced round variants are supported.
Test vectors for 20/12/8 round variants generated with reference implementation from estreambench-20080905.
This boosts speed on 64 bit Java 7, OS X Macbook Pro 2.5GHz Core i5 from 100MB/s (23 c/b) to 114MB/s (21 c/b) (measured on long streams).
@ghost ghost assigned bcgit Jul 14, 2013
@peterdettman
Copy link
Collaborator

Merged with minor conflicts resolved. Thanks very much, Tim.

@bcgit bcgit removed their assignment May 26, 2020
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

Successfully merging this pull request may close these issues.

3 participants