Skip to content

Commit 864b6e3

Browse files
Use SHA1 intrinsics when asm feature is enabled (#225)
1 parent f6a0efd commit 864b6e3

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sha1/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.9.3 (2021-02-01)
9+
### Changed
10+
- Use SHA1 intrinsics when `asm` feature is enabled. ([#225])
11+
12+
[#225]: https://github.com/RustCrypto/hashes/pull/225
13+
814
## 0.9.2 (2020-11-04)
915
### Added
1016
- `force-soft` feature to enforce use of software implementation. ([#203])

sha1/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sha-1"
3-
version = "0.9.2"
3+
version = "0.9.3"
44
description = "SHA-1 hash function"
55
authors = ["RustCrypto Developers"]
66
license = "MIT OR Apache-2.0"

sha1/src/compress.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ cfg_if::cfg_if! {
99
mod soft;
1010
mod aarch64;
1111
use aarch64::compress as compress_inner;
12-
} else if #[cfg(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64")))] {
13-
fn compress_inner(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
14-
for block in blocks {
15-
sha1_asm::compress(state, block);
16-
}
17-
}
1812
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
13+
#[cfg(not(feature = "asm"))]
1914
mod soft;
15+
#[cfg(feature = "asm")]
16+
mod soft {
17+
pub(crate) fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
18+
for block in blocks {
19+
sha1_asm::compress(state, block);
20+
}
21+
}
22+
}
2023
mod x86;
2124
use x86::compress as compress_inner;
2225
} else {

0 commit comments

Comments
 (0)