# crypto.salsa20: make the number of rounds a comptime parameter \(\#13442\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/30d392a87e7ebd51269a557b6bccbc3163e8db75)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 30d392a87e7ebd51269a557b6bccbc3163e8db75

Requested commit: 30d392a87e7ebd51269a557b6bccbc3163e8db75

Commit: 30d392a87e7ebd51269a557b6bccbc3163e8db75

Tree: 89d6b99524223fb3938c719e3cd587a88292aa7d

Author: Frank Denis

Committer: Andrew Kelley

## Message

```
crypto.salsa20: make the number of rounds a comptime parameter (#13442)

...instead of hard-coding it to 20.

- This is consistent with the ChaCha implementation
- NaCl and libsodium, that this API is designed to interop with,
also support 8 and 12 round variants. The 12 round variant, in
particular, provides the same security level as the 20 round variant,
but is obviously faster.
- scrypt currently uses its own non optimized version of Salsa, just
because it use 8 rounds instead of 20. This will help remove code
duplication.

No behavior nor public API changes. The Salsa20 and XSalsa20 still
represent the 20-round variant.
```

## Parents

- [8d488246da1665f147dcc00b5e6d253cfc3598eb](https://git.cafe/gitcafe/zig/commit/8d488246da1665f147dcc00b5e6d253cfc3598eb?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/30d392a87e7ebd51269a557b6bccbc3163e8db75?format=markdown)
