chacha_block_generic(9)
π chacha_block_generic(9)
okay so bestie, welcome to the Kernel API Manual β yes we're in the kernel now, bring your sparkliest brain cell. today's main character is chacha_block_generic, and she is literally the ChaCha core itself. no cap. πβ¨
β¨ NAME β¨
chacha_block_generic β generate one keystream block and increment block counter π
like, she makes you one keystream block, and as a little bonus she bumps the block counter for you on the way out. multitasking queen. π
πΈ SYNOPSIS πΈ
void chacha_block_generic (struct chacha_state *state , u8
out[CHACHA_BLOCK_SIZE] , int nrounds );
copy that exactly, don't @ me. π«Ά
π¦ ARGUMENTS π¦
stateβ the input state matrix. this is where the vibes (and the counter) live going in.outβ the output keystream block. it'su8 out[CHACHA_BLOCK_SIZE], so she's got exactly the room she needs. πnroundsβ number of rounds, and it's either20or12.20is the recommended one, so likeβ¦ pick20unless you have a reason. iykyk. π₯
π DESCRIPTION π
This is the ChaCha core, fr fr β a function from 64-byte strings to 64-byte strings. 64 bytes in, 64 bytes out, that's the whole personality. π
important detail: the caller has already converted the endianness of the input. so don't come for her about endianness, that's not her job, that was done before she showed up. π
she also handles incrementing the block counter in the input matrix β so yes, she mutates the input state matrix's block counter as part of the deal. not me getting a side effect in a crypto function, but honestly? iconic. β¨
heads up bestie: state is a pointer and the block counter inside it gets incremented β that's the documented behaviour, so plan accordingly. π
π SEE ALSO π
- the kernel file
./lib/crypto/chacha-block-generic.cβ go read the source, she's right there π hchacha_block_generic(9)β her cousin, also slaying π
okay that's the whole page, you ate that. she's from ./lib/crypto, this is the October 2026 era, and it's all under the Kernel API Manual banner β periodt. π
ππ¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms