(data: &[u8])
| 16 | } |
| 17 | |
| 18 | pub fn sha256(data: &[u8]) -> [u8; 32] { |
| 19 | use sha2::Digest; |
| 20 | let mut sha256 = sha2::Sha256::new(); |
| 21 | sha256.update(data); |
| 22 | sha256.finalize().into() |
| 23 | } |
| 24 | |
| 25 | pub fn sha256_file(path: impl AsRef<Path>) -> Result<[u8; 32]> { |
| 26 | let data = fs::read(path).context("Failed to read file")?; |
no outgoing calls