Parse from a base32 string into a byte array
(input: &str)
| 72 | |
| 73 | /// Parse from a base32 string into a byte array |
| 74 | fn parse_array<const N: usize>(input: &str) -> Result<[u8; N], DecodeError> { |
| 75 | data_encoding::BASE32_NOPAD |
| 76 | .decode(input.to_ascii_uppercase().as_bytes())? |
| 77 | .try_into() |
| 78 | .map_err(|_| DecodeError { |
| 79 | position: N, |
| 80 | kind: DecodeKind::Length, |
| 81 | }) |
| 82 | } |
| 83 | |
| 84 | impl std::fmt::Display for B256 { |
| 85 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |