Expand description
src/key/secp256k1/public_key.rs (
line 111)
109
110
111
112
pub fn to_short_bytes(&self) -> io::Result<Vec<u8>> {
let compressed = self.to_compressed_bytes();
hash::sha256_ripemd160(&compressed)
}
More examples
Hide additional examples
77
78
79
80
81
82
83
84
pub fn from_cert_der_bytes<S>(cert_bytes: S) -> io::Result<Self>
where
S: AsRef<[u8]>,
{
let short_address = hash::sha256_ripemd160(cert_bytes)?;
let node_id = Self::from_slice(&short_address);
Ok(node_id)
}
57
58
59
60
61
62
63
64
65
66
67
pub fn from_public_key_bytes<S>(pub_key_bytes: S) -> io::Result<Self>
where
S: AsRef<[u8]>,
{
let hashed = hash::sha256_ripemd160(pub_key_bytes)?;
let encoded = formatting::encode_cb58_with_checksum_string(&hashed);
Self::from_str(&encoded)
}