Skip to content

[x.crypto.chacha20] 64bit internal counter #23904

@einar-hjortdal

Description

@einar-hjortdal

Describe the feature

chacha20 uses a 32bit internal counter which limits the stream to 256GB of data. To work around this limitation of the IETF RFC8439 algo, many programs and libraries decided to utilize a 64bit counter instead.

I request this non-standard variant be available. If not in vlib I request help, from those who know how chacha20 works, in order to implement this variant as a third party library so that the V language community can make use of it.

libtomcrypt, libsodium, bouncy castle, and more crypto libraries offer chacha20 with 64bit nonce and 64bit counter. What changes should be made to the current implementation to make it work the same way?

Refs:

Use Case

Connect to services that use non-IETF-standard chacha20 cipher

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

V 0.4.9 5f5e48e

Environment details (OS name and version, etc.)

|V full version      |V 0.4.9 537605a
|:-------------------|:-------------------
|OS                  |linux, "openmamba release 2024.6 for x86_64 (rolling)"
|Processor           |8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
|Memory              |4.63GB/31.17GB
|                    |
|V executable        |/home/einar/.local/lib64/v/v
|V last modified time|2025-02-25 15:36:48
|                    |
|V home dir          |OK, value: /home/einar/.local/lib64/v
|VMODULES            |OK, value: /home/einar/.vmodules
|VTMP                |OK, value: /tmp/v_1000
|Current working dir |OK, value: /home/einar/Documents/projects/vlang/active/firebird
|                    |
|Git version         |git version 2.48.1
|V git status        |weekly.2025.09-2-g537605a0 (17 commit(s) behind V master)
|.git/config present |true
|                    |
|cc version          |cc (GCC) 14.2.1 20240909
|gcc version         |gcc (GCC) 14.2.1 20240909
|clang version       |N/A
|tcc version         |tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
|tcc git status      |thirdparty-linux-amd64 0134e9b9
|emcc version        |N/A
|glibc version       |ldd (GNU libc) 2.41

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions