libssh2_hostkey_hash(3)
π libssh2_hostkey_hash β bestie, it's the hostkey hash page π
okay so this is a page from the libssh2 manual (section 3, if you're keeping score), and it's literally all about grabbing a hash of the remote host's key. no cap. let's get into it β¨
πΈ NAME πΈ
libssh2_hostkey_hash β return a hash of the remote host's key
β¨ SYNOPSIS β¨
#include <libssh2.h>
const char *
libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
π¦ DESCRIPTION π¦
sessionβ the session instance, and bestie you gotta get it fromlibssh2_session_init_ex(3)or it's not gonna work, iykyk π«Άhash_typeβ pick your fighter, it's one of:LIBSSH2_HOSTKEY_HASH_MD5,LIBSSH2_HOSTKEY_HASH_SHA1orLIBSSH2_HOSTKEY_HASH_SHA256.
So what does it actually do? It returns the computed digest of the remote system's hostkey. the way that the length of the returned string is hash_type specificβ¦ like, 16 bytes for MD5, 20 bytes for SHA1, 32 bytes for SHA256. slay π
π RETURN VALUE π
You get the computed hostkey hash value back, or NULL if the info is just not available β and that happens in two cases: either the session hasn't been started up yet, or the hash algorithm you asked for wasn't available. π
β οΈ real talk: the hash is made of raw binary bytes, not hex digits, so it is not directly printable. do not try to print it like a string, it will give you chaos π
π SEE ALSO π
kisses, bestie π this was the libssh2 manual, version 0.15, dated 1 Jun 2007 β go hash that hostkey, you absolute icon πβ¨π
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms