bitcoin-bigint 0.1.19

Provides an efficient macro-based approach to define and manipulate arbitrary-precision unsigned integers, crucial for cryptographic operations on Bitcoin.
1
2
3
4
5
6
7
8
9
10
11
// ---------------- [ File: bitcoin-bigint/src/hex_to_val.rs ]
crate::ix!();

// A small helper used by From<&str> for nibble decoding
pub fn hex_to_val(ch: char) -> u8 {
    match ch {
        '0'..='9' => (ch as u8) - b'0',
        'A'..='F' => (ch as u8) - b'A' + 10,
        _ => 0,
    }
}