KNET_GET...HASH_LIST(3)

πŸ“¦ version 1.35, in fedora 43, fedora 44

πŸ’– knet_get_crypto_hash_list β€” bestie edition πŸ’–

okay so you're in the Kronosnet Programmer's Manual, section 3 (that's the library-calls girlypop section, iykyk), and we're about to talk about knet_get_crypto_hash_list. grab a snack. this one's short but she's iconic. ✨


🌸 NAME 🌸

knet_get_crypto_hash_list β€” get a list of commonly supported hash algorithms. that's it. that's the whole vibe. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libknet.h>

int knet_get_crypto_hash_list(
    struct knet_crypto_hash_info   *hash_list,
    size_t                         *hash_list_entries
);

look at her. two args. no drama. πŸ’…


✨ DESCRIPTION ✨

okay so knet_get_crypto_hash_list is literally the friend who tells you which hash algorithms everyone can agree on.

this function returns hash algorithms that are supported across all crypto backends (OpenSSL, NSS, libgcrypt). no cap β€” the list represents the intersection of capabilities, not backend-specific features. so if you're out here expecting a special lil exclusive algorithm that only one backend has? not today, bestie. intersection only. 🀝

now the args, let's go:

  • hash_list β€” array of struct knet_crypto_hash_info. if it's NULL, then only the number of structs is returned in hash_list_entries, which is literally there so you can allocate sufficient space. and listen: it is safe to allocate 16 structs to avoid calling this function twice. so you could just do the two-call dance, or you could be efficient and grab 16 slots up front. main character energy either way. πŸ‘‘
  • hash_list_entries β€” returns the number of hash algorithms in hash_list. slay.

🧚 STRUCTURES 🧚

structure returned from knet_get_crypto_hash_list() containing information about supported hash algorithms:

struct knet_crypto_hash_info {
    const char   *name;       /* Hash algorithm name (e.g., "sha256", "sha512") */
    int           hash_bits;  /* Hash output size in bits */
    char          pad[256];   /* Currently unused padding */
};

so name is the algorithm name (think "sha256", "sha512" β€” the classics πŸ’–), hash_bits is the hash output size in bits, and pad is 256 bytes of currently unused padding. she's just sitting there. minding her business. don't touch her. πŸ™ˆ


🫢 RETURN VALUE 🫢

knet_get_crypto_hash_list returns 0 on success, -1 on error, and errno is set. that's the whole story. if you got a 0, you ate. if you got a -1, check errno and regroup. 😭


🌈 SEE ALSO 🌈

the whole friend group, in the exact order they showed up:


Copyright (C) 2010-2026 Red Hat, Inc. All rights reserved.


that's the whole page, bestie. go call it, pass NULL first if you're feeling cautious, or just vibe with those 16 structs. periodt. πŸ’œ

kronosnet Β· 2026-07-20 Β· and that's a wrap on KNET_GET...HASH_LIST(3) πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from