I'm writing a school assignment and I'm trying to fully grasp the differences between Salsa20 and ChaCha.

I've come to understand that by rotating upwards the initial matrix columns, DJB says that thanks to SIMD each quarter-round will run in parallel for each column, effectively running four quarter-rounds at the same time.

But if the following round has to be run on diagonals how can this be optimized for SIMDs? Will it rotate again columns to make the diagonals into rows? Will this rotation affect performance or the benefit of the SIMD beats this?

  • $\begingroup$ Columns are easy to vectorize. Rows are harder. Diagonals are just a rotation followed by a column, so they're still pretty easy to vectorize and apparently faster than rows. I don't know enough about SIMD to make this a formal answer. $\endgroup$ Feb 6, 2018 at 18:10
  • $\begingroup$ This paper describe the ChaCha vectorisation eprint.iacr.org/2013/759.pdf $\endgroup$
    – rducom
    Jun 6, 2020 at 18:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.