#[non_exhaustive]pub enum Fingerprint {
Sha256([u8; 32]),
Sha512([u8; 64]),
}Expand description
SSH public key fingerprints.
Fingerprints have an associated key fingerprint algorithm, i.e. a hash function which is used to compute the fingerprint.
§Parsing/serializing fingerprint strings
The FromStr and Display impls on Fingerprint can be used to
parse and serialize fingerprints from the string format.
§Example
SHA256:Nh0Me49Zh9fDw/VYUfq43IJmI1T+XrjiYONPND8GzaM§serde support
When the serde feature of this crate is enabled, this type receives impls
of [Deserialize][serde::Deserialize] and [Serialize][serde::Serialize].
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sha256([u8; 32])
Fingerprints computed using SHA-256.
Sha512([u8; 64])
Fingerprints computed using SHA-512.
Implementations§
Source§impl Fingerprint
impl Fingerprint
Sourcepub fn new(algorithm: HashAlg, public_key: &KeyData) -> Self
pub fn new(algorithm: HashAlg, public_key: &KeyData) -> Self
Create a fingerprint of the given public key data using the provided hash algorithm.
Sourcepub fn prefix(self) -> &'static str
pub fn prefix(self) -> &'static str
Get the name of the hash algorithm (upper case e.g. “SHA256”).
Sourcepub fn fmt_randomart(self, header: &str, f: &mut Formatter<'_>) -> Result
pub fn fmt_randomart(self, header: &str, f: &mut Formatter<'_>) -> Result
Format “randomart” for this fingerprint using the provided formatter.
Sourcepub fn to_randomart(self, header: &str) -> String
pub fn to_randomart(self, header: &str) -> String
Render “randomart” hash visualization for this fingerprint as a string.
+--[ED25519 256]--+
|o+oO==+ o.. |
|.o++Eo+o.. |
|. +.oO.o . . |
| . o..B.. . . |
| ...+ .S. o |
| .o. . . . . |
| o.. o |
| B . |
| .o* |
+----[SHA256]-----+Trait Implementations§
Source§impl AsRef<[u8]> for Fingerprint
impl AsRef<[u8]> for Fingerprint
Source§impl Clone for Fingerprint
impl Clone for Fingerprint
Source§fn clone(&self) -> Fingerprint
fn clone(&self) -> Fingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Fingerprint
impl Debug for Fingerprint
Source§impl Display for Fingerprint
impl Display for Fingerprint
Source§impl FromStr for Fingerprint
impl FromStr for Fingerprint
Source§impl Ord for Fingerprint
impl Ord for Fingerprint
Source§fn cmp(&self, other: &Fingerprint) -> Ordering
fn cmp(&self, other: &Fingerprint) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Fingerprint
impl PartialEq for Fingerprint
Source§fn eq(&self, other: &Fingerprint) -> bool
fn eq(&self, other: &Fingerprint) -> bool
self and other values to be equal, and is used by ==.