---
name: "libressl-X509_NAME_hash"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-X509_NAME_hash"
---

# libressl-X509\_NAME\_hash(3)

calculate SHA-1 or MD5 hashes of X.501 Name objects

## NAME

**X509\_NAME\_hash**, **X509\_issuer\_name\_hash**, **X509\_subject\_name\_hash**, **X509\_NAME\_hash\_old**, **X509\_issuer\_name\_hash\_old**, **X509\_subject\_name\_hash\_old** – calculate SHA-1 or MD5 hashes of X.501 Name objects

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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

**X509\_NAME\_hash**() calculates an SHA1(3) hash of the DER-encoded form of *name*. It is for example used by X509\_LOOKUP\_hash\_dir(3) to locate certificate files in the file system.

**X509\_issuer\_name\_hash**() and **X509\_subject\_name\_hash**() are wrappers to calculate this hash of the issuer or subject name of *x*, respectively.

**X509\_NAME\_hash\_old**(), **X509\_issuer\_name\_hash\_old**(), and **X509\_subject\_name\_hash\_old**() are variants that use MD5 instead of SHA-1.

## RETURN VALUES

These functions return the hash value or 0 if an error occurs.

## SEE ALSO

i2d\_X509\_NAME(3), X509\_get\_subject\_name(3), X509\_LOOKUP\_new(3), X509\_NAME\_digest(3), X509\_NAME\_new(3)

## HISTORY

**X509\_subject\_name\_hash**() first appeared in SSLeay 0.4.0, **X509\_issuer\_name\_hash**() in SSLeay 0.5.1, and **X509\_NAME\_hash**() in SSLeay 0.8.0. They were switched to hashing the DER representation of the name rather than an ASCII rendering in SSLeay 0.9.0 and have all been available since OpenBSD 2.4.

They were switched to using SHA-1 instead of MD5 in OpenSSL 1.0.0 and in OpenBSD 4.9.

**X509\_NAME\_hash\_old**(), **X509\_issuer\_name\_hash\_old**(), and **X509\_subject\_name\_hash\_old**() first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.
