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_checksumkrb5_checksum_disablekrb5_checksum_is_collision_proofkrb5_checksum_is_keyedkrb5_checksumsizekrb5_cksumtype_validkrb5_copy_checksumkrb5_create_checksumkrb5_crypto_get_checksum_typekrb5_free_checksumkrb5_free_checksum_contentskrb5_hmackrb5_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 inresult. Here's the tea π: ifcryptoisNULL, thenusage_or_typespecifies the checksum type to use, and it must not be keyed. Otherwisecryptois an encryption context created bykrb5_crypto_init(), andusage_or_typespecifies 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 areMD5andSHA1, whileCRC32is 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 areHMAC-SHA1-DES3andRSA-MD5-DES. The "plain" hash functionsMD5andSHA1are 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 withkrb5_checksumsize()when you want to know the size a checksum will use when you create it. dynamic duo behavior π«Άkrb5_cksumtype_valid()β returns0, 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. andkrb5_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 incksum. just the contents this time β¨krb5_hmac()β calculates the HMAC overdata(with lengthlen) using the keyusageusageand keyblockkey. Note thatkeyusageis 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
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- debian bookworm: heimdal-dev 7.8.git20221117.28daf24+dfsg-2 Β· BSD-3-Clause
- debian trixie: heimdal-dev 7.8.git20221117.28daf24+dfsg-9+deb13u1 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- freebsd 14.5: base 14.5
- nixpkgs unstable: heimdal 7.8.0-unstable-2024-09-10
- ubuntu jammy: heimdal-dev 7.7.0+dfsg-3ubuntu1 Β· BSD-3-Clause
- ubuntu noble: heimdal-dev 7.8.git20221117.28daf24+dfsg-5ubuntu3 Β· BSD-3-Clause
- ubuntu questing: heimdal-dev 7.8.git20221117.28daf24+dfsg-9ubuntu1
- ubuntu resolute: heimdal-dev 7.8.git20221117.28daf24+dfsg-11ubuntu1 Β· BSD-3-Clause
- ubuntu stonking: heimdal-dev 7.8.git20240113.1b4565a+dfsg-2ubuntu1 Β· BSD-3-Clause
- Copyright (c) 1999-2005 Kungliga Tekniska HΓΆgskolan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms