chacha_block_generic(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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's u8 out[CHACHA_BLOCK_SIZE], so she's got exactly the room she needs. πŸ’–
  • nrounds β€” number of rounds, and it's either 20 or 12. 20 is the recommended one, so like… pick 20 unless 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