Crates.io | rs_sha224 |
lib.rs | rs_sha224 |
version | 0.1.4 |
source | src |
created_at | 2023-05-30 11:10:01.262868 |
updated_at | 2023-06-12 16:44:43.189079 |
description | `rs_sha224` is a Rust implementation of the SHA-224 cryptographic hash algorithm, part of the larger `rs_shield` project. This package provides SHA-224 hashing functionality in a standalone manner, ideal for when only SHA-224 is required. Alternatively, for those seeking a comprehensive set of cryptographic functions, this same algorithm is included within the broader `rs_shield` library bundle. The focus of `rs_sha224` and the larger project is on performance, safety, and openness, with a commitment to ongoing maintenance and enhancement. |
homepage | https://docs.rs/rs_shield/latest/rs_shield/ |
repository | https://github.com/Azgrom/RustyShield |
max_upload_size | |
id | 877801 |
size | 37,981 |
rs_sha224
rs_sha224
is a Rust crate delivering the SHA-224 cryptographic hash algorithm. Configured for compatibility with Rust's libcore within a #![no_std]
context, it operates as a standalone crate for specialized use cases and is also compatible with a #![no_std]
, #![no_alloc]
environment, rendering it suitable for systems where dynamic memory allocation is untenable.
This implementation of SHA-224 is compliant with the Federal Information Processing Standards (FIPS) Publication 180-41. In line with the National Institute of Standards and Technology (NIST) guidelines, SHA-224 is recommended for several use cases:
"SHA-224 provides 112 bits of security against collision attacks and, therefore, is suitable for functions requiring a hash length of 112 bits."
Given this advice, NIST recommendations imply that SHA-224 is suitable for the following contexts:
Beyond these specific recommendations, SHA-224 could also find application in:
Given your overall security objectives and risk tolerance, these points should be carefully considered.
For access to a comprehensive range of cryptographic functions, rs_sha224
can be utilized as part of the rs_shield
library bundle.
Below are steps to use the rs_sha224
crate in your Rust projects:
Add the following line to your Cargo.toml
under the [dependencies]
section:
rs_sha224 = "0.1.*"
Use the functions provided by the rs_sha224
module in your code. Here's an example of how to create a SHA-224 hash from a string:
use rs_sha224::{HasherContext, Sha224Hasher};
let mut sha224hasher = Sha224Hasher::default();
sha224hasher.write(b"your string here");
let u64result = sha224hasher.finish();
let bytes_result = HasherContext::finish(&mut sha224hasher);
assert_eq!(u64result, 0xC8DA90DF20FC1F9C);
assert_eq!(format!("{bytes_result:02x}"), "c8da90df20fc1f9cad8bec106821904e8a27b9bcc79d954f1fa01b83");
assert_eq!(format!("{bytes_result:02X}"), "C8DA90DF20FC1F9CAD8BEC106821904E8A27B9BCC79D954F1FA01B83");
assert_eq!(
bytes_result,
[
0xC8, 0xDA, 0x90, 0xDF, 0x20, 0xFC, 0x1F, 0x9C, 0xAD, 0x8B, 0xEC, 0x10, 0x68, 0x21, 0x90, 0x4E, 0x8A, 0x27,
0xB9, 0xBC, 0xC7, 0x9D, 0x95, 0x4F, 0x1F, 0xA0, 0x1B, 0x83
]
)
For a more detailed exploration of rs_sha224
, an overview of other available cryptographic functions, and an introduction to the broader rs_shield
project, please consult the RustyShield project page on crates.io.
Potential contributors are encouraged to consult the contribution guidelines on our GitHub page.
This project is licensed under GPL-2.0-only.
Note: The references have been provided as per the best knowledge as of Jun 02, 2023.
National Institute of Standards and Technology. (2015). Secure Hash Standard (SHS). FIPS PUB 180-4 ↩
Linus Torvalds. (2005). Git: A distributed version control system. Software: Practice and Experience, 41(1), 79-88. DOI:10.1002/spe.1006 ↩
Krawczyk, H., Bellare, M., & Canetti, R. (1997). HMAC: Keyed-Hashing for Message Authentication. RFC 2104 ↩
Merkle, R. C. (1988). A Digital Signature Based on a Conventional Encryption Function. Link ↩
Bloom, B. H. (1970). Space/time trade-offs in hash coding with allowable errors. Communications of the ACM, 13(7), 422-426. DOI:10.1145/362686.362692 ↩