MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / hex_digit

Function hex_digit

nodedb/src/ctl/rotate_ca.rs:123–130  ·  view source on GitHub ↗
(b: u8)

Source from the content-addressed store, hash-verified

121}
122
123fn hex_digit(b: u8) -> Result<u8, String> {
124 match b {
125 b'0'..=b'9' => Ok(b - b'0'),
126 b'a'..=b'f' => Ok(10 + b - b'a'),
127 b'A'..=b'F' => Ok(10 + b - b'A'),
128 other => Err(format!("invalid hex char: {:?}", other as char)),
129 }
130}
131
132fn write_pem(path: &Path, der: &[u8]) -> std::io::Result<()> {
133 use base64::Engine;

Callers 1

hex_decodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected