do_shash(9)
π do_shash(9) β a little love letter from the Kernel API Manual
Okay bestie, listen πβ¨ this one lives in the Kernel API Manual, page do_shash(9), and it does exactly what it says on the tin: it's about doing a synchronous hash operation in software. Iconic. Let's get into it π«Ά
πΈ SYNOPSIS πΈ
int do_shash(unsigned char *name, unsigned char *result, const u8 *data1,
unsigned int data1_len, const u8 *data2, unsigned int data2_len,
const u8 *key, unsigned int key_len);
That's a lot of args, I know, but we're gonna go through every single one, no skipping, fr fr π
π ARGUMENTS π
nameβ the name of the hash algorithm. Like, the algorithm's whole identity. main character energy πresultβ the buffer where the digest gets written. This is where the magic lands, bestie β¨data1β first part of the data to hash. It may beNULL, so don't stress if you've got nothing for it πdata1_lenβ length ofdata1, in bytes. Gotta measure, always πdata2β second part of the data to hash. Also may beNULL. Two chunks, one hash, we love a split π¦data2_lenβ length ofdata2, in byteskeyβ the key, but like, if it's a keyed hash. Non-keyed? Don't worry abt it πkey_lenβ length ofkey, in bytes β or0if it's a non-keyed hash. Zero means no key, periodt π
β DESCRIPTION β
So here's the tea, and it's an important lil' caveat β: the crypto API is not gonna pick this driver's own transform, because this driver only registers asynchronous algos. So, like, don't expect it to grab itself. It won't. It literally can't. No cap π
π₯ RETURN π₯
0β slay! The hash was successfully stored inresultβ< 0β not slay π something went wrong
π§ SEE ALSO π§
Kernel file ./drivers/crypto/bcm/util.c, plus these very good friends:
Go read them, iykyk ππ
And that's the whole vibe check, bestie π this page came to you from ./drivers/crypto/bcm, dated October 2026 β mwah, love u, go hash something ππ
π¦ 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