hmac_sha256_usingrawkey(9)
π
hmac_sha256_usingrawkey β Kernel API Manual, section 9 π
okay so picture this: you're in kernel land (yes, the kernel, we're fancy now β¨), and you need one single HMAC-SHA256. Not a whole session. Not a whole state machine. Just one. And you've got the raw key sitting right there in your hand like π«Ά. That's this function, bestie. It does the whole thing in one shot, no cap.
πΈ NAME πΈ
hmac_sha256_usingrawkey β Compute HMAC-SHA256 in one shot, using a raw key π
β¨ SYNOPSIS β¨
void hmac_sha256_usingrawkey (const u8 *raw_key , size_t raw_key_len ,
const u8 *data , size_t data_len , u8 out[static SHA256_DIGEST_SIZE] );
like, five args, zero drama. she's an icon, she's a legend, and she is the moment π
π¦ ARGUMENTS π¦
raw_keyβ the raw HMAC-SHA256 key itself. just... the key. raw. unprocessed. the real deal πraw_key_lenβ the key length in bytes. and listen β All key lengths are supported. every single one. no cap, no restrictions, she does not gatekeep π₯dataβ the message data π©data_lenβ the data length in bytesoutβ (output) the resulting HMAC-SHA256 value. this is where the magic lands, bestie π«
π DESCRIPTION π
So like, the actual vibe here is minimal because the function is minimal. But here's the one thing you need to know, and it's giving "listen to me for two seconds":
If you're using the key multiple times, prefer to usehmac_sha256_preparekeyfollowed by multiple calls tohmac_sha256instead. π
fr fr. one-shot is for one shot. if you're looping, prep the key once and reuse it β that's the whole point. don't be out here re-deriving a key forty times in a loop, it's not the move π
π CONTEXT π
Any context. literally any. no constraints, no prerequisites, no special preemption rules. she's flexible like that π§
π SEE ALSO π
the whole sha2 extended universe, in the exact order the kernel lists it β iykyk π
Kernel file ./include/crypto/sha2.h and friends:
struct sha224_ctx(9)sha224_init(9)sha224_update(9)sha224_final(9)sha224(9)struct hmac_sha224_key(9)struct hmac_sha224_ctx(9)hmac_sha224_preparekey(9)hmac_sha224_init(9)hmac_sha224_init_usingrawkey(9)hmac_sha224_update(9)hmac_sha224_final(9)hmac_sha224(9)hmac_sha224_usingrawkey(9)struct sha256_ctx(9)sha256_init(9)sha256_update(9)sha256_final(9)sha256(9)sha256_finup_2x(9)sha256_finup_2x_is_optimized(9)struct hmac_sha256_key(9)struct hmac_sha256_ctx(9)hmac_sha256_preparekey(9)hmac_sha256_init(9)hmac_sha256_init_usingrawkey(9)hmac_sha256_update(9)hmac_sha256_final(9)hmac_sha256(9)struct sha384_ctx(9)sha384_init(9)sha384_update(9)sha384_final(9)sha384(9)struct hmac_sha384_key(9)struct hmac_sha384_ctx(9)hmac_sha384_preparekey(9)hmac_sha384_init(9)hmac_sha384_init_usingrawkey(9)hmac_sha384_update(9)hmac_sha384_final(9)hmac_sha384(9)hmac_sha384_usingrawkey(9)struct sha512_ctx(9)sha512_init(9)sha512_update(9)sha512_final(9)sha512(9)struct hmac_sha512_key(9)struct hmac_sha512_ctx(9)hmac_sha512_preparekey(9)hmac_sha512_init(9)hmac_sha512_init_usingrawkey(9)hmac_sha512_update(9)hmac_sha512_final(9)hmac_sha512(9)hmac_sha512_usingrawkey(9)
π and that's the page!! tysm for reading, you ate that π
signed, sealed, and shipped from ./include/crypto, dated October 2026 β Kernel API Manual, hmac_sha256_usingrawkey(9) βπ¦π
π¦ 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