fn to_ssh_fingerprint(peer_id: &PeerId) -> Result<Vec<u8>, std::io::Error> {
    use byteorder::{BigEndian, WriteBytesExt};
    use sha2::Digest;

    let mut buf = Vec::new();
    let name = b"ssh-ed25519";
    let key = peer_id.as_public_key().as_ref();

    buf.write_u32::<BigEndian>(name.len() as u32)?;
    buf.extend_from_slice(name);
    buf.write_u32::<BigEndian>(key.len() as u32)?;
    buf.extend_from_slice(key);

    Ok(sha2::Sha256::digest(&buf).to_vec())
}
/// Get the SSH key fingerprint from a peer id.
Get the SSH key fingerprint from a peer id.
Get the SSH key fingerprint from a peer id .
fn to_ssh_fingerprint(peer_id: &PeerId) -> Result<Vec<u8>, std::io::Error> {
    use byteorder::{BigEndian, WriteBytesExt};
    use sha2::Digest;
    let mut buf = Vec::new();
    let name = b"ssh-ed25519";
    let key = peer_id.as_public_key().as_ref();
    buf.write_u32::<BigEndian>(name.len() as u32)?;
    buf.extend_from_slice(name);
    buf.write_u32::<BigEndian>(key.len() as u32)?;
    buf.extend_from_slice(key);
    Ok(sha2::Sha256::digest(&buf).to_vec())
}
fn to_ssh_fingerprint ( peer_id : & PeerId ) -> Result < Vec < u8 > , std :: io :: Error > { use byteorder :: { BigEndian , WriteBytesExt } ; use sha2 :: Digest ; let mut buf = Vec :: new ( ) ; let name = b" " ; let key = peer_id . as_public_key ( ) . as_ref ( ) ; buf . write_u32 :: < BigEndian > ( name . len ( ) as u32 ) ? ; buf . extend_from_slice ( name ) ; buf . write_u32 :: < BigEndian > ( key . len ( ) as u32 ) ? ; buf . extend_from_slice ( key ) ; Ok ( sha2 :: Sha256 :: digest ( & buf ) . to_vec ( ) ) }
Get the SSH key fingerprint from a peer id.
Get the SSH key fingerprint from a peer id .
peer_id
&PeerId
peer_id
&PeerId