Skip to content
uencoder

Salsa20

Salsa20 is a stream cipher designed by Daniel Bernstein, built on ARX operations with 20 rounds; it is an eSTREAM-recommended algorithm and the predecessor of ChaCha20.

Purpose

It provides fast, constant-time-secure stream encryption, avoiding the padding and mode complexity of block ciphers.

Mechanism

The state is a 4×4 matrix (constant σ, key, nonce, counter). Each round applies the quarter-round (add-rotate-XOR) to every column and every row. After 20 rounds the state is added to the initial state to produce the keystream.

Use cases

  • eSTREAM recommended algorithm
  • The NaCl crypto library
  • Cryptography research
  • Teaching examples

Examples

  • Input
    key=256bit, nonce=64bit
    Output
    keystream

    ChaCha20 is its improved successor

Common errors

Using Salsa20 instead of the safer ChaCha20
Prefer ChaCha20-Poly1305

Related terms

Related tools

References