nh(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 + 48 bytes of it get used. and if message_len is at its maximum length of NH_MESSAGE_BYTES, then that's exactly NH_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 of 16 (NH_MESSAGE_UNIT) and at most 1024 (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