crypto_shash_descsize(9)
๐ crypto_shash_descsize(9) โ the Kernel API Manual glow-up ๐
okay bestie, welcome to the Kernel API Manual corner of the universe โจ this one's a lil function that tells you how much room your hash's operational state needs. short page, but iconic.
โจ NAME โจ
crypto_shash_descsize โ obtain the operational state size ๐ซถ
๐ธ SYNOPSIS ๐ธ
unsigned int crypto_shash_descsize (struct crypto_shash *tfm );
like, that's the whole signature. no notes. ๐
๐ฆ ARGUMENTS ๐ฆ
tfmโ the cipher handle ๐ this is the one you're asking about.
โญ DESCRIPTION โญ
so basically, this hands you back the size of the operational state that the cipher needs while it's doing its thing โ specifically for the hash that's referenced by that cipher handle. ๐
and why do we care? because you literally need this number to work out your memory requirements, so you can allocate enough memory for that operational state. no cap, you can't skip the math. ๐งฎ
the operational state is defined with struct shash_desc, and the way you calculate the size of that data structure is:
sizeof(struct shash_desc) + crypto_shash_descsize(alg)
that's the formula, memorize it, put it on a sticky note, tattoo it on your arm, whatever works ๐ญโจ
๐ฅ RETURN ๐ฅ
size of the operational state ๐ (yes, that's it. it returns the size. slay.)
๐ SEE ALSO ๐
okay this is the part where the page goes full main-character and lists, like, everyone it knows. respect the friend group ๐
- Kernel file:
./include/crypto/hash.h Message Digest Algorithm Definitions(9)struct ahash_alg(9)struct shash_alg(9)Asynchronous Message Digest API(9)crypto_alloc_ahash(9)crypto_free_ahash(9)crypto_has_ahash(9)crypto_ahash_blocksize(9)crypto_ahash_digestsize(9)crypto_ahash_statesize(9)crypto_ahash_reqtfm(9)crypto_ahash_reqsize(9)crypto_ahash_setkey(9)crypto_ahash_finup(9)crypto_ahash_final(9)crypto_ahash_digest(9)crypto_ahash_export(9)crypto_ahash_import(9)crypto_ahash_init(9)crypto_ahash_update(9)Asynchronous Hash Request Handle(9)ahash_request_set_tfm(9)ahash_request_alloc(9)ahash_request_free(9)ahash_request_set_callback(9)ahash_request_set_crypt(9)ahash_request_set_virt(9)Synchronous Message Digest API(9)crypto_alloc_shash(9)crypto_free_shash(9)crypto_shash_blocksize(9)crypto_shash_digestsize(9)crypto_shash_setkey(9)crypto_shash_digest(9)crypto_shash_tfm_digest(9)crypto_shash_export(9)crypto_shash_import(9)crypto_shash_init(9)crypto_shash_finup(9)crypto_shash_update(9)crypto_shash_final(9)
ngl bestie, if you got all the way down here you're genuinely built different ๐ go forth and allocate responsibly.
and that's a wrap on this little page ๐ it lives in the source dir ./include/crypto, dated October 2026, filed under crypto_shash_descsize(9) in the Kernel API Manual โ mwah, bye bestie ๐
โจ๐ธ
๐ฆ 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