#[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
and Serialize
.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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
Available on crate feature alloc
only.
pub fn to_randomart(self, header: &str) -> String
alloc
only.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
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Fingerprint
impl Debug for Fingerprint
source§impl<'de> Deserialize<'de> for Fingerprint
Available on crate features alloc
and serde
only.
impl<'de> Deserialize<'de> for Fingerprint
Available on crate features
alloc
and serde
only.source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for Fingerprint
impl PartialEq for Fingerprint
source§impl PartialOrd for Fingerprint
impl PartialOrd for Fingerprint
source§impl Serialize for Fingerprint
Available on crate features alloc
and serde
only.
impl Serialize for Fingerprint
Available on crate features
alloc
and serde
only.impl Copy for Fingerprint
impl Eq for Fingerprint
impl StructuralPartialEq for Fingerprint
Auto Trait Implementations§
impl Freeze for Fingerprint
impl RefUnwindSafe for Fingerprint
impl Send for Fingerprint
impl Sync for Fingerprint
impl Unpin for Fingerprint
impl UnwindSafe for Fingerprint
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)