diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/Cargo.toml | 2 | ||||
-rw-r--r-- | shared/src/store.rs | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 8665019..394983a 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -8,6 +8,6 @@ anyhow = "1.0.95" bincode = "1.3.3" glam = { version = "0.29.2", features = ["serde"] } redb = "2.4.0" -sha2 = "0.11.0-pre.4" log = "0.4.22" rand = "0.9.0-beta.1" +blake3 = "1.5.5" 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() } |