summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-13 15:50:49 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-13 15:50:49 +0100
commita976b24a54ae8c26759af18ddef849f336c6d4ec (patch)
treeb65533118175d25946f060b932410be12bc26d37 /shared
parentfffd27abb3b3e1cbe0a4236ee68be5bf6588a20c (diff)
downloadweareserver-a976b24a54ae8c26759af18ddef849f336c6d4ec.tar
weareserver-a976b24a54ae8c26759af18ddef849f336c6d4ec.tar.bz2
weareserver-a976b24a54ae8c26759af18ddef849f336c6d4ec.tar.zst
fix resource hash padding
Diffstat (limited to 'shared')
-rw-r--r--shared/src/packets.rs2
-rw-r--r--shared/src/store.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/shared/src/packets.rs b/shared/src/packets.rs
index 2100edc..093247d 100644
--- a/shared/src/packets.rs
+++ b/shared/src/packets.rs
@@ -186,7 +186,7 @@ impl<T> Display for Resource<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
- "Res{{{:08x}{:08x}{:08x}{:08x}}}",
+ "Res{{{:016x}{:016x}{:016x}{:016x}}}",
u64::from_be_bytes(self.0[0..8].try_into().unwrap()),
u64::from_be_bytes(self.0[8..16].try_into().unwrap()),
u64::from_be_bytes(self.0[16..24].try_into().unwrap()),
diff --git a/shared/src/store.rs b/shared/src/store.rs
index 08e62be..86ae053 100644
--- a/shared/src/store.rs
+++ b/shared/src/store.rs
@@ -139,7 +139,7 @@ pub fn resource_hash(x: &[u8]) -> [u8; 32] {
fn fs_cache_path(path: &Path, res: Resource) -> PathBuf {
path.join(format!(
- "{:08x}{:08x}{:08x}{:08x}",
+ "{:016x}{:016x}{:016x}{:016x}",
u64::from_be_bytes(res.0[0..8].try_into().unwrap()),
u64::from_be_bytes(res.0[8..16].try_into().unwrap()),
u64::from_be_bytes(res.0[16..24].try_into().unwrap()),