4 use std::io::{Read, Write};
7 let mut dst = env::current_exe().unwrap();
9 dst.push("linker-arguments1");
12 dst.push("linker-arguments2");
13 assert!(!dst.exists());
16 let mut out = String::new();
17 for arg in env::args().skip(1) {
18 let path = Path::new(&arg);
25 let mut contents = Vec::new();
26 File::open(path).unwrap().read_to_end(&mut contents).unwrap();
28 out.push_str(&format!("{}: {}\n", arg, hash(&contents)));
31 File::create(dst).unwrap().write_all(out.as_bytes()).unwrap();
35 fn hash(contents: &[u8]) -> u64 {
36 let mut hash = 0xcbf29ce484222325;
38 for byte in contents {
39 hash = hash ^ (*byte as u64);
40 hash = hash.wrapping_mul(0x100000001b3);