Skip to content

Commit

Permalink
Truncate symbol hashes to 64 bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Dec 31, 2013
1 parent 8ec03b3 commit 4e75265
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use std::run;
use std::str;
use std::io;
use std::io::fs;
use extra::hex::ToHex;
use extra::tempfile::TempDir;
use syntax::abi;
use syntax::ast;
Expand Down Expand Up @@ -494,8 +495,10 @@ pub fn build_link_meta(sess: Session,
}
}

pub fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
symbol_hasher.result_str()
fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
let output = symbol_hasher.result_bytes();
// 64 bits should be enough to avoid collisions.
output.slice_to(8).to_hex()
}


Expand Down

1 comment on commit 4e75265

@alexcrichton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.