diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-12 22:18:08 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-12 22:18:08 +0100 |
commit | 32b749262d305b5ce09d1fc0c02f40023033c9bd (patch) | |
tree | 9088d5309febd3102e758b3f82d0eede4b26bac5 /shared/src/store.rs | |
parent | 2731017aa88bf6baaff787d7486d4248f9ca6ca0 (diff) | |
download | weareserver-32b749262d305b5ce09d1fc0c02f40023033c9bd.tar weareserver-32b749262d305b5ce09d1fc0c02f40023033c9bd.tar.bz2 weareserver-32b749262d305b5ce09d1fc0c02f40023033c9bd.tar.zst |
sha256 -> blake3
Diffstat (limited to 'shared/src/store.rs')
-rw-r--r-- | shared/src/store.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/shared/src/store.rs b/shared/src/store.rs index 37e3ab1..673a40e 100644 --- a/shared/src/store.rs +++ b/shared/src/store.rs @@ -17,7 +17,6 @@ use crate::{helper::ReadWrite, packets::Resource}; use anyhow::Result; use redb::{Database, TableDefinition}; -use sha2::{Digest, Sha256}; use std::{collections::HashMap, marker::PhantomData, path::Path, sync::Mutex}; const T_ENTRIES: TableDefinition<[u8; 32], &[u8]> = TableDefinition::new("e"); @@ -59,7 +58,7 @@ impl ResourceStore { } } pub fn set_raw(&self, value: &[u8]) -> Result<Resource> { - let key = Resource(sha256(value), PhantomData); + let key = Resource(resource_hash(value), PhantomData); match self { ResourceStore::Redb(database) => { let txn = database.begin_write()?; @@ -85,8 +84,8 @@ impl ResourceStore { } } -pub fn sha256(x: &[u8]) -> [u8; 32] { - let mut hasher = Sha256::new(); +pub fn resource_hash(x: &[u8]) -> [u8; 32] { + let mut hasher = blake3::Hasher::new(); hasher.update(x); hasher.finalize().into() } |