Files
MatrixGW/matrixgw_backend/src/utils/crypt_utils.rs
2025-11-21 15:43:15 +01:00

12 lines
297 B
Rust

use sha2::{Digest, Sha256, Sha512};
/// Compute SHA256sum of a given string
pub fn sha256str(input: &str) -> String {
hex::encode(Sha256::digest(input.as_bytes()))
}
/// Compute SHA256sum of a given byte array
pub fn sha512(input: &[u8]) -> String {
hex::encode(Sha512::digest(input))
}