This commit is contained in:
Quaternions 2024-12-06 18:57:11 -08:00
parent bc6613f235
commit 0977943834
3 changed files with 11 additions and 3 deletions

9
validation/Cargo.lock generated
View File

@ -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"

View File

@ -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"] }

View File

@ -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),