nh(9)
π nh(9) β like, the NH hash function for Adiantum, bestie π
okay so this is a page from the Kernel API Manual (that's the manual name, iykyk) and it's all about nh, the NH hash function that Adiantum uses. it's giving crypto-core, it's giving "i read the Adiantum paper," and honestly? we're obsessed. let's get into it π«Ά
β¨ SYNOPSIS β¨
void nh (const u32 *key , const u8 *message , size_t message_len ,
__le64 hash[NH_NUM_PASSES] );
like, that's the whole vibe right there π
π ARGUMENTS π
keyβ the key, babes.message_len + 48bytes of it get used. and ifmessage_lenis at its maximum length ofNH_MESSAGE_BYTES, then that's exactlyNH_KEY_BYTES. math is mathing πmessageβ the message. yeah, that's it. that's the message π¨message_lenβ the message length in bytes. lowkey strict about this one: it must be a multiple of16(NH_MESSAGE_UNIT) and at most1024(NH_MESSAGE_BYTES). no cap, it will not accept your weird lengths πhashβ (output) the resulting hash value. this is where the slay gets written β¨
β οΈ NOTE β οΈ
okay so this is the part where you gotta pay attention, bestie, because it's a whole thing π
the pseudocode for NH in the Adiantum paper iterates over 1024-byte segments of the message, computes a 32-byte hash for each one, and returns all the hashes concatenated together.
in contrast, this function? it just hashes one segment and returns one hash. that's it. one and done π―
so it's the caller's responsibility to call this function for each 1024-byte segment and collect all the hashes. yes, you. you're the main character here, you gotta do the collecting π§Ί
fr fr, don't forget this part or your hash will be short and sad π
π CONTEXT π
Any context. literally any. go off, king π
π¦ SEE ALSO π¦
- Kernel file
./include/crypto/nh.hβ go read it, it's iconic π
and that's the page, bestie!! πβ¨
signed off with love from ./include/crypto β version/date vibes: October 2026 πΈ and remember: nh(9) forever and always π
π¦ 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