From 09779438343a3967ce25739bfa71678a0a4294ee Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 6 Dec 2024 18:57:11 -0800 Subject: [PATCH] fix hash --- validation/Cargo.lock | 9 ++++++++- validation/Cargo.toml | 1 + validation/src/validator.rs | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/validation/Cargo.lock b/validation/Cargo.lock index 78e6721..15a8e4d 100644 --- a/validation/Cargo.lock +++ b/validation/Cargo.lock @@ -985,6 +985,7 @@ dependencies = [ "rbx_xml", "serde", "serde_json", + "siphasher", "tokio", ] @@ -1309,7 +1310,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1816,6 +1817,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 567fe90..e9d6fee 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -14,4 +14,5 @@ rbx_reflection_database = { version = "0.2.12", registry = "strafesnet"} rbx_xml = { version = "0.13.3", registry = "strafesnet"} serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" +siphasher = "1.0.1" tokio = { version = "1.41.1", features = ["macros", "rt-multi-thread", "fs"] } diff --git a/validation/src/validator.rs b/validation/src/validator.rs index 4087dc1..08414df 100644 --- a/validation/src/validator.rs +++ b/validation/src/validator.rs @@ -101,8 +101,8 @@ impl Validator{ } // send all scripts to REST endpoint and receive the replacements for (source,replacement) in &mut script_map{ - let mut hasher=std::hash::SipHasher::new(); - std::hash::Hash::hash(&source,&mut hasher); + let mut hasher=siphasher::sip::SipHasher::new(); + std::hash::Hasher::write(&mut hasher,source.as_bytes()); let hash=std::hash::Hasher::finish(&hasher); let script_policy=self.api.get_script_policy_from_hash(api::ScriptPolicyHashRequest{ hash:format!("{:x}",hash),