Function libherokubuildpack::sha256 [−][src]
pub fn sha256(path: impl AsRef<Path>) -> Result<String, Error>
Expand description
Obtains the SHA256 checksum of a file as a hex string
Examples
use libherokubuildpack::sha256;
use std::fs::write;
use tempfile::tempdir;
let temp_dir = tempdir().unwrap();
let temp_file = temp_dir.path().join("test.txt");
write(&temp_file, "Hello World!").unwrap();
let sha256_sum = sha256(&temp_file).unwrap();
assert_eq!(sha256_sum, "7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069");