Lowercase-hex encode bytes.
(bytes: &[u8])
| 300 | |
| 301 | /// Lowercase-hex encode bytes. |
| 302 | fn hex_encode(bytes: &[u8]) -> String { |
| 303 | let mut s = String::with_capacity(bytes.len() * 2); |
| 304 | for b in bytes { |
| 305 | s.push_str(&format!("{b:02x}")); |
| 306 | } |
| 307 | s |
| 308 | } |
| 309 | |
| 310 | /// Compute the lowercase-hex sha256 of `bytes`. |
| 311 | fn sha256_hex(bytes: &[u8]) -> String { |