Files
continuwuity/src/core/utils/hash/sha256.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
295 B
Rust
Raw Normal View History

2024-07-03 00:44:00 +00:00
use ring::{digest, digest::SHA256};
2024-07-07 19:03:15 +00:00
#[tracing::instrument(skip_all, level = "debug")]
2024-07-03 00:44:00 +00:00
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()
}