Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit a91e5f7

Browse files
committed
SSH-01-010: Improve documentation for fingerprinting functions
Fixes T184 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com> (cherry picked from commit cb0ccf3)
1 parent 7b7b2ac commit a91e5f7

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/dh.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,16 @@ static char *ssh_get_b64_unpadded(const unsigned char *hash, size_t len)
696696
/**
697697
* @brief Get a hash as a human-readable hex- or base64-string.
698698
*
699-
* This gets an allocated fingerprint hash. It is a hex strings if the given
700-
* hash is a md5 sum. If it is a SHA sum, it will return an unpadded base64
701-
* strings. Either way, the output is prepended by the hash-type.
699+
* This gets an allocated fingerprint hash. If it is a SHA sum, it will
700+
* return an unpadded base64 strings. If it is a MD5 sum, it will return hex
701+
* string. Either way, the output is prepended by the hash-type.
702702
*
703-
* @param type Which sort of hash is given.
703+
* @warning Do NOT use MD5 or SHA1! Those hash functions are being deprecated.
704704
*
705-
* @param hash What should be converted to a base64 string.
705+
* @param type Which sort of hash is given, use
706+
* SSH_PUBLICKEY_HASH_SHA256 or better.
707+
*
708+
* @param hash The hash to be converted to fingerprint.
706709
*
707710
* @param len Length of the buffer to convert.
708711
*
@@ -769,13 +772,13 @@ char *ssh_get_fingerprint_hash(enum ssh_publickey_hash_type type,
769772
/**
770773
* @brief Print a hash as a human-readable hex- or base64-string.
771774
*
772-
* This function prints hex strings if the given hash is a md5 sum.
773-
* But prints unpadded base64 strings for sha sums.
774-
* Either way, the output is prepended by the hash-type.
775+
* This prints an unpadded base64 strings for SHA sums and hex strings for MD5
776+
* sum. Either way, the output is prepended by the hash-type.
775777
*
776-
* @param type Which sort of hash is given.
778+
* @param type Which sort of hash is given. Use
779+
* SSH_PUBLICKEY_HASH_SHA256 or better.
777780
*
778-
* @param hash What should be converted to a base64 string.
781+
* @param hash The hash to be converted to fingerprint.
779782
*
780783
* @param len Length of the buffer to convert.
781784
*

0 commit comments

Comments
 (0)