package core:crypto/chacha20
Overview
package chacha20 implements the ChaCha20 and XChaCha20 stream ciphers.
See: https://datatracker.ietf.org/doc/html/rfc8439 https://datatracker.ietf.org/doc/draft-irtf-cfrg-xchacha/03/
Index
Types (2)
Constants (4)
Variables (0)
This section is empty.
Procedures (5)
Procedure Groups (0)
This section is empty.
Types
Context ¶
Context :: struct { _state: _chacha20.Context, _impl: Implementation, }
Context is a ChaCha20 or XChaCha20 instance.
Related Procedures With Parameters
Implementation ¶
Implementation :: enum int { Portable, Simd128, Simd256, }
Implementation is a ChaCha20 implementation. Most callers will not need to use this as the package will automatically select the most performant implementation available.
Related Procedures With Parameters
Related Constants
Constants
DEFAULT_IMPLEMENTATION ¶
DEFAULT_IMPLEMENTATION :: Implementation.Simd256
DEFAULT_IMPLEMENTATION is the implementation that will be used by default if possible.
Variables
This section is empty.
Procedures
init ¶
init :: proc(ctx: ^Context, key, iv: []u8, impl: Implementation = DEFAULT_IMPLEMENTATION) {…}
init inititializes a Context for ChaCha20 or XChaCha20 with the provided key and iv.
keystream_bytes ¶
keystream_bytes fills dst with the raw (X)ChaCha20 keystream output.
reset ¶
reset :: proc(ctx: ^Context) {…}
reset sanitizes the Context. The Context must be re-initialized to be used again.
seek ¶
seek seeks the (X)ChaCha20 stream counter to the specified block.
xor_bytes ¶
xor_bytes XORs each byte in src with bytes taken from the (X)ChaCha20 keystream, and writes the resulting output to dst. Dst and src MUST alias exactly or not at all.
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2024-11 (vendor "odin") Windows_amd64 @ 2024-11-20 21:11:50.526550200 +0000 UTC