mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2025-12-13 18:59:00 -05:00
split hash utils into directory
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
df0328f43f
commit
52d470058a
4 changed files with 88 additions and 65 deletions
9
src/core/utils/hash/sha256.rs
Normal file
9
src/core/utils/hash/sha256.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use ring::{digest, digest::SHA256};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(super) fn hash(keys: &[&[u8]]) -> Vec<u8> {
|
||||
// We only hash the pdu's event ids, not the whole pdu
|
||||
let bytes = keys.join(&0xFF);
|
||||
let hash = digest::digest(&SHA256, &bytes);
|
||||
hash.as_ref().to_owned()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue