Last active
July 10, 2023 01:51
-
-
Save t1hq/bfeefc48332b0df8c27f145b56590e12 to your computer and use it in GitHub Desktop.
lsp appid catagory hash calculation demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "wctest" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
wchar = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use wchar::{wch, wchar_t}; | |
fn main() { | |
const PATH: &[wchar_t] = wch!(":\\WINDOWS\\SYSTEM32\\SVCHOST.EXE"); | |
let mut sum: u32 = 0; | |
for &w in PATH { | |
sum = sum.wrapping_mul(0x25).wrapping_add(w as u32); | |
} | |
let mul = sum.wrapping_mul(0x12b9b0a5); | |
let m = mul >> 0x1f; | |
let h = mul ^ m - m; | |
println!("hash: {:08X}", h % 0x3b9aca07); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment