(input: &str, output: &mut Vec<u8>)
| 1880 | } |
| 1881 | |
| 1882 | fn base64_decode(input: &str, output: &mut Vec<u8>) { |
| 1883 | let mut buf = 0u32; |
| 1884 | let mut bits = 0u32; |
| 1885 | for &b in input.as_bytes() { |
| 1886 | let val = match b { |
| 1887 | b'A'..=b'Z' => b - b'A', |
| 1888 | b'a'..=b'z' => b - b'a' + 26, |
| 1889 | b'0'..=b'9' => b - b'0' + 52, |
| 1890 | b'+' => 62, |
| 1891 | b'/' => 63, |
| 1892 | b'=' | b'\n' | b'\r' => continue, |
| 1893 | _ => continue, |
| 1894 | }; |
| 1895 | buf = (buf << 6) | val as u32; |
| 1896 | bits += 6; |
| 1897 | if bits >= 8 { |
| 1898 | bits -= 8; |
| 1899 | output.push((buf >> bits) as u8); |
| 1900 | buf &= (1 << bits) - 1; |
| 1901 | } |
| 1902 | } |
| 1903 | } |
| 1904 | |
| 1905 | // ---- Catmull-Rom spline helpers (Q9) ---- |
| 1906 |
no test coverage detected