1 use bitcoin::secp256k1::PublicKey;
3 pub fn to_vec(hex: &str) -> Option<Vec<u8>> {
4 let mut out = Vec::with_capacity(hex.len() / 2);
7 for (idx, c) in hex.as_bytes().iter().enumerate() {
10 b'A'..=b'F' => b |= c - b'A' + 10,
11 b'a'..=b'f' => b |= c - b'a' + 10,
12 b'0'..=b'9' => b |= c - b'0',
24 pub fn to_compressed_pubkey(hex: &str) -> Option<PublicKey> {
25 let data = match to_vec(&hex[0..33 * 2]) {
29 match PublicKey::from_slice(&data) {