Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/sha1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ jobs:
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --features asm
- run: cargo test --all-features
2 changes: 1 addition & 1 deletion Cargo.lock

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

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

## 0.9.4 (2021-02-16)
### Added
- Expose compression function under the `compress` feature flag. ([#238])

[#238]: https://github.com/RustCrypto/hashes/pull/238

## 0.9.3 (2021-02-01)
### Changed
- Use SHA1 intrinsics when `asm` feature is enabled. ([#225])
Expand Down
10 changes: 7 additions & 3 deletions sha1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sha-1"
version = "0.9.3"
version = "0.9.4"
description = "SHA-1 hash function"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -35,8 +35,12 @@ hex-literal = "0.2"
default = ["std"]
std = ["digest/std"]
asm = ["sha1-asm", "libc"]
# Force software implementation
force-soft = []
compress = [] # Expose compress function
force-soft = [] # Force software implementation

# DEPRECATED: use `asm` instead
asm-aarch64 = ["asm"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions sha1/src/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ cfg_if::cfg_if! {
}
}

/// SHA-1 compression function
#[cfg_attr(docsrs, doc(cfg(feature = "compress")))]
pub fn compress(state: &mut [u32; 5], blocks: &[GenericArray<u8, U64>]) {
// SAFETY: GenericArray<u8, U64> and [u8; 64] have
// exactly the same memory layout
Expand Down
4 changes: 4 additions & 0 deletions sha1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
//! [2]: https://github.com/RustCrypto/hashes

#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
Expand All @@ -37,6 +38,9 @@ extern crate std;
mod compress;
mod consts;

#[cfg(feature = "compress")]
pub use crate::compress::compress;
#[cfg(not(feature = "compress"))]
use crate::compress::compress;
use crate::consts::{H, STATE_LEN};
use block_buffer::BlockBuffer;
Expand Down