Can download uploaded images

This commit is contained in:
2023-08-07 14:53:44 +02:00
parent c6148f6562
commit 75438f4ae0
10 changed files with 166 additions and 6 deletions

View File

@ -1,6 +1,14 @@
use sha2::{Digest, Sha512};
use sha2::{Digest, Sha256, Sha512};
/// Compute hash of a slice of bytes
pub fn sha256(bytes: &[u8]) -> String {
let mut hasher = Sha256::new();
hasher.update(bytes);
let h = hasher.finalize();
format!("{:x}", h)
}
/// Compute hash of a slice of bytes (sha512)
pub fn sha512(bytes: &[u8]) -> String {
let mut hasher = Sha512::new();
hasher.update(bytes);