ChaCha now available

19 views
Skip to first unread message

Jeffrey Walton

unread,
Apr 21, 2016, 12:26:51 PM4/21/16
to Crypto++ Users
Hi Everyone,

We added ChaCha8, ChaCha12 and ChaCha20 this afternoon. I could not find test vectors for the seek operation, so its currently disabled and throws a NotImplemented() exception.

Commits at:

  * http://github.com/weidai11/cryptopp/commit/53b51331a4e1d9664bc93a0f1597fc2e70506234
  * http://github.com/weidai11/cryptopp/commit/38f6c33789e1a029595564dd5663622b15410d35
  * http://github.com/weidai11/cryptopp/commit/90bb31360d556d182bb8e4c9e24901563d64878c

There are no self tests, but there are test vectors. the test vectors can be run with:

    ./cryptest.exe tv all    # All test vectors
    ./cryptest.exe tv chacha    # ChaCha8, ChaCha12 and ChaCha20

There's an opportunity for an SSE2 implementation if anyone is interested. Salsa20 has and its inline ASM had too many problems with the GCC 5.x compilers, so I did not want to copy/paste it and then endure the subtle bugs. If anyone has time for an SSE2 implementation using intrinsics (_mm_X), then I'd be happy to check it in.

Jeff

Jean-Pierre Münch

unread,
Apr 21, 2016, 5:19:08 PM4/21/16
to cryptop...@googlegroups.com

Hey Jeffrey,

I took a look at the implementation and found a bunch of points which I found optimization worthy. An according PR will be provided shortly.

  • ChaCha is capable of using user-defined amounts of rounds. The current implementation doesn't allow that (as opposed to Salsa20). I've fixed it by introducing an additional info class that is like yours and by modifying the existing one to not be templatified by round number. The benefit of this change is that the user can dynamically at run-time decide which variant to use rather than at compile-time (or by using ugly pointers himself)
  • You've copy-pasted the definitions for encryption and decryption. It's easier to just define Encryption to be the same as the decryption (as was done with Salsa). The benefit of this change is the increased readability of the code.

I've applied all these changes and it didn't break anything (for me).

BR

JPM

--
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-user...@googlegroups.com.
More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages