12 lines
356 B
Rust
12 lines
356 B
Rust
use sha2::{Digest, Sha256};
|
|
|
|
pub(crate) fn sha256_hex(parts: impl IntoIterator<Item = String>) -> String {
|
|
let mut hasher = Sha256::new();
|
|
hasher.update(b"crank-config-fingerprint-v1\0");
|
|
for part in parts {
|
|
hasher.update(part.len().to_le_bytes());
|
|
hasher.update(part.as_bytes());
|
|
}
|
|
format!("{:x}", hasher.finalize())
|
|
}
|