# std.crypto.chacha: remove the hack for ChaCha with a 64-bit counter \(\#15818\) · gitcafe/zig

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

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

Visibility: public

Requested revision: 057d30bacc4d97f53c2e69585dc8d50186cfc7f5

Requested commit: 057d30bacc4d97f53c2e69585dc8d50186cfc7f5

Commit: 057d30bacc4d97f53c2e69585dc8d50186cfc7f5

Tree: 0611d5cf2910f3f90707b71dbdac044d75ac030b

Author: Frank Denis

Committer: GitHub

## Message

```
std.crypto.chacha: remove the hack for ChaCha with a 64-bit counter (#15818)

Support for 64-bit counters was a hack built upon the version with
a 32-bit counter, that emulated a larger counter by splitting the
input into large blocks.

This is fragile, particularily if the initial counter is set to
a non-default value and if we have parallelism.

Simply add a comptime parameter to check if we have a 32 bit or a
64 bit counter instead.

Also convert a couple while() loops to for(), and change @panic()
to @compileError().
```

## Parents

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

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