X509_NAME_HASH(3)
β¨ X509_NAME_HASH β¨
okay so bestie, we're in the libcrypto cinematic universe today and this page is all about turning an X.501 Name into a little hash number π
hi bestie, welcome to the X509_NAME_HASH(3) page, this is the group chat
πΈ SYNOPSIS πΈ
library βlibcryptoβ #include <openssl/x509.h>
unsigned long
X509_NAME_hash(X509_NAME *name);
unsigned long
X509_issuer_name_hash(X509 *x);
unsigned long
X509_subject_name_hash(X509 *x);
unsigned long
X509_NAME_hash_old(X509_NAME *name);
unsigned long
X509_issuer_name_hash_old(X509 *x);
unsigned long
X509_subject_name_hash_old(X509 *x);
π DESCRIPTION π
So like, six whole functions, all of them returning an unsigned long, all of them hashing a name. Let's break it down fr fr π
X509_NAME_hash()β calculates anSHA1(3)hash of the DER-encoded form of name. it's giving "used byX509_LOOKUP_hash_dir(3)to locate certificate files in the file system" β that's literally its whole job bestie ποΈβ¨X509_issuer_name_hash()β wrapper that calculates, like, this same hash but for the issuer name of x. same energy, different name πX509_subject_name_hash()β another wrapper, this one for the subject name of x. twin behavior, no cap π«ΆX509_NAME_hash_old(),X509_issuer_name_hash_old(), andX509_subject_name_hash_old()β the variants that useMD5instead ofSHA-1. yes, MD5. the old one. that's the whole vibe of the_oldsuffix π
not me emphasizing that X509_NAME_hash() hashes the DER-encoded form β that detail is load-bearing, don't skip it π
β RETURN VALUES β
these functions return the hash value, or 0 if an error occurs. so if you get a 0... that's not a cute hash bestie, that's a problem π
π¦ SEE ALSO π¦
go read those, iykyk ππ
π HISTORY π
okay the lore is actually kind of iconic so sit down π
X509_subject_name_hash()first appeared inSSLeay 0.4.0,X509_issuer_name_hash()inSSLeay 0.5.1, andX509_NAME_hash()inSSLeay 0.8.0.- they were switched to hashing the DER representation of the name rather than an ASCII rendering in
SSLeay 0.9.0β character development fr π - they've all been available since
OpenBSD 2.4. - they were switched to using
SHA-1instead ofMD5inOpenSSL 1.0.0and inOpenBSD 4.9. X509_NAME_hash_old(),X509_issuer_name_hash_old(), andX509_subject_name_hash_old()first appeared inOpenSSL 1.0.0and have been available sinceOpenBSD 4.9.
and that's the page!! π this little writeup came from the Debian folks and it's dated June 8, 2025 β mwah, thank you for the lore drop, we ate π«Άβ¨π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms