Skip to content

Commit

Permalink
Auto merge of #37439 - michaelwoerister:remove-sha256, r=alexcrichton
Browse files Browse the repository at this point in the history
Replace all uses of SHA-256 with BLAKE2b.

Removes the SHA-256 implementation and replaces all uses of it with BLAKE2b, which we already use for debuginfo type guids and incremental compilation hashes. It doesn't make much sense to have two different cryptographic hash implementations in the compiler and Blake has a few advantages over SHA-2 (computationally less expensive, hashes of up to 512 bits).
  • Loading branch information
bors authored Oct 31, 2016
2 parents 8f1fc86 + 9ef9194 commit 4497196
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 812 deletions.
2 changes: 1 addition & 1 deletion mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_bo
rustc_trans rustc_privacy rustc_lint rustc_plugin \
rustc_metadata syntax_ext proc_macro_plugin \
rustc_passes rustc_save_analysis rustc_const_eval \
rustc_incremental syntax_pos rustc_errors proc_macro
rustc_incremental syntax_pos rustc_errors proc_macro rustc_data_structures
DEPS_rustc_errors := log libc serialize syntax_pos
DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
Expand Down
1 change: 1 addition & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ pub mod traits;
pub mod ty;

pub mod util {
pub use rustc_back::sha2;

pub mod common;
pub mod ppaux;
pub mod nodemap;
Expand Down
5 changes: 5 additions & 0 deletions src/librustc/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
///
/// The same goes for endianess: We always convert multi-byte integers to little
/// endian before hashing.
#[derive(Debug)]
pub struct ArchIndependentHasher<H> {
inner: H,
}
Expand All @@ -413,6 +414,10 @@ impl<H> ArchIndependentHasher<H> {
pub fn new(inner: H) -> ArchIndependentHasher<H> {
ArchIndependentHasher { inner: inner }
}

pub fn into_inner(self) -> H {
self.inner
}
}

impl<H: Hasher> Hasher for ArchIndependentHasher<H> {
Expand Down
4 changes: 1 addition & 3 deletions src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
#![feature(rand)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(step_by)]
#![cfg_attr(stage0, feature(question_mark))]
#![cfg_attr(test, feature(test, rand))]
#![cfg_attr(test, feature(rand))]

extern crate syntax;
extern crate libc;
Expand All @@ -48,7 +47,6 @@ extern crate serialize;
extern crate serialize as rustc_serialize; // used by deriving

pub mod tempdir;
pub mod sha2;
pub mod target;
pub mod slice;
pub mod dynamic_lib;
Expand Down
Loading

0 comments on commit 4497196

Please sign in to comment.