GeneIT/geneit_backend/src/utils/crypt_utils.rs

10 lines
224 B
Rust
Raw Normal View History

2023-08-07 09:07:24 +00:00
use sha2::{Digest, Sha512};
/// Compute hash of a slice of bytes
pub fn sha512(bytes: &[u8]) -> String {
let mut hasher = Sha512::new();
hasher.update(bytes);
let h = hasher.finalize();
format!("{:x}", h)
}