NAME(3)

πŸ’– NAME πŸ’–

okay bestie, welcome to the NAME(3) page of the Library Functions Manual ✨ this one's all about checksums β€” creating them, handling them, and verifying them πŸŽ€

Here's the whole squad, fr fr:

  • krb5_checksum
  • krb5_checksum_disable
  • krb5_checksum_is_collision_proof
  • krb5_checksum_is_keyed
  • krb5_checksumsize
  • krb5_cksumtype_valid
  • krb5_copy_checksum
  • krb5_create_checksum
  • krb5_crypto_get_checksum_type
  • krb5_free_checksum
  • krb5_free_checksum_contents
  • krb5_hmac
  • krb5_verify_checksum

and their whole thing is: creates, handles and verifies checksums πŸ’… no cap.


🌸 LIBRARY 🌸

Kerberos 5 Library β€” that's libkrb5, link it with -lkrb5 πŸ¦‹


✨ SYNOPSIS ✨

#include <krb5.h>

typedef Checksum krb5_checksum;

void
krb5_checksum_disable(krb5_context context, krb5_cksumtype type);

krb5_boolean
krb5_checksum_is_collision_proof(krb5_context context,
    krb5_cksumtype type);

krb5_boolean
krb5_checksum_is_keyed(krb5_context context, krb5_cksumtype type);

krb5_error_code
krb5_cksumtype_valid(krb5_context context, krb5_cksumtype ctype);

krb5_error_code
krb5_checksumsize(krb5_context context, krb5_cksumtype type,
    size_t *size);

krb5_error_code
krb5_create_checksum(krb5_context context, krb5_crypto crypto,
    krb5_key_usage usage, int type, void *data, size_t len,
    Checksum *result);

krb5_error_code
krb5_verify_checksum(krb5_context context, krb5_crypto crypto,
    krb5_key_usage usage, void *data, size_t len, Checksum *cksum);

krb5_error_code
krb5_crypto_get_checksum_type(krb5_context context, krb5_crypto crypto,
    krb5_cksumtype *type);

void
krb5_free_checksum(krb5_context context, krb5_checksum *cksum);

void
krb5_free_checksum_contents(krb5_context context, krb5_checksum *cksum);

krb5_error_code
krb5_hmac(krb5_context context, krb5_cksumtype cktype, const void *data,
    size_t len, unsigned usage, krb5_keyblock *key, Checksum *result);

krb5_error_code
krb5_copy_checksum(krb5_context context, const krb5_checksum *old,
    krb5_checksum **new);

πŸ‘‘ DESCRIPTION πŸ‘‘

So the krb5_checksum structure holds a Kerberos checksum. And listen β€” there is no component inside krb5_checksum that is directly referable πŸ™ˆ like, don't go poking at the fields, bestie, they're not for you.

The whole point of these functions is to create and verify checksums. Here's the rundown:

  • krb5_create_checksum() β€” creates a checksum of the specified data and drops it in result. Here's the tea πŸ“: if crypto is NULL, then usage_or_type specifies the checksum type to use, and it must not be keyed. Otherwise crypto is an encryption context created by krb5_crypto_init(), and usage_or_type specifies a key-usage. two vibes, one function, iconic.
  • krb5_verify_checksum() β€” verifies the checksum against the provided data. the vibe check for your data, basically βœ…
  • krb5_checksum_is_collision_proof() β€” returns true is the specified checksum is collision proof, meaning it's very unlikely that two strings has the same hash value, and that it's hard to find two strings that has the same hash πŸ”₯ examples of collision proof checksums are MD5 and SHA1, while CRC32 is not. CRC32 could never πŸ’€
  • krb5_checksum_is_keyed() β€” returns true if the specified checksum type is keyed, meaning the hash value is a function of both the data and a separate key πŸ”‘ examples of keyed hash algorithms are HMAC-SHA1-DES3 and RSA-MD5-DES. The "plain" hash functions MD5 and SHA1 are not keyed. not them being unkeyed and unbothered πŸ’…
  • krb5_crypto_get_checksum_type() β€” returns the checksum type that will be used when creating a checksum for the given crypto context. This one is highkey useful in combination with krb5_checksumsize() when you want to know the size a checksum will use when you create it. dynamic duo behavior 🫢
  • krb5_cksumtype_valid() β€” returns 0, or an error if the checksumtype is implemented and not currently disabled in this kerberos library.
  • krb5_checksumsize() β€” returns the size of the outdata of checksum function πŸ“
  • krb5_copy_checksum() β€” returns a copy of the checksum. and krb5_free_checksum() should use used to free the new checksum, so don't forget that part bestie 😭
  • krb5_free_checksum() β€” free the checksum and the content of the checksum. both. the whole thing. gone 🧚
  • krb5_free_checksum_contents() β€” frees the content of checksum in cksum. just the contents this time ✨
  • krb5_hmac() β€” calculates the HMAC over data (with length len) using the keyusage usage and keyblock key. Note that keyusage is not always used in checksums. sometimes it just vibes in the corner, iykyk 🌈
  • krb5_checksum_disable β€” globally disables the checksum type. globally. like it's over, it's done, no more πŸ’€

🌟 SEE ALSO 🌟


and that's the page, bestie πŸ’– this one's brought to you by HEIMDAL, dated August 12, 2005 β€” yeah she's a classic, an absolute legend, and she still ate πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from