Skip to content
Open
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
9 changes: 1 addition & 8 deletions src/uu/hashsum/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,15 @@ hashsum-help-ignore-missing = don't fail or report status for missing files
hashsum-help-warn = warn about improperly formatted checksum lines
hashsum-help-zero = end each output line with NUL, not newline
hashsum-help-length = digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8

# Algorithm help messages
hashsum-help-md5 = work with MD5
hashsum-help-sha1 = work with SHA1
hashsum-help-sha224 = work with SHA224
hashsum-help-sha256 = work with SHA256
hashsum-help-sha384 = work with SHA384
hashsum-help-sha512 = work with SHA512
hashsum-help-sha3 = work with SHA3
hashsum-help-sha3-224 = work with SHA3-224
hashsum-help-sha3-256 = work with SHA3-256
hashsum-help-sha3-384 = work with SHA3-384
hashsum-help-sha3-512 = work with SHA3-512
hashsum-help-shake128 = work with SHAKE128 using BITS for the output size
hashsum-help-shake256 = work with SHAKE256 using BITS for the output size
hashsum-help-b2sum = work with BLAKE2
hashsum-help-b3sum = work with BLAKE3

# Error messages
hashsum-error-failed-to-read-input = failed to read input
8 changes: 0 additions & 8 deletions src/uu/hashsum/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@ hashsum-help-sha224 = travailler avec SHA224
hashsum-help-sha256 = travailler avec SHA256
hashsum-help-sha384 = travailler avec SHA384
hashsum-help-sha512 = travailler avec SHA512
hashsum-help-sha3 = travailler avec SHA3
hashsum-help-sha3-224 = travailler avec SHA3-224
hashsum-help-sha3-256 = travailler avec SHA3-256
hashsum-help-sha3-384 = travailler avec SHA3-384
hashsum-help-sha3-512 = travailler avec SHA3-512
hashsum-help-shake128 = travailler avec SHAKE128 en utilisant BITS pour la taille de sortie
hashsum-help-shake256 = travailler avec SHAKE256 en utilisant BITS pour la taille de sortie
hashsum-help-b2sum = travailler avec BLAKE2
hashsum-help-b3sum = travailler avec BLAKE3

# Messages d'erreur
hashsum-error-failed-to-read-input = échec de la lecture de l'entrée
43 changes: 1 addition & 42 deletions src/uu/hashsum/src/hashsum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ use uucore::checksum::compute::{
use uucore::checksum::validate::{
ChecksumValidateOptions, ChecksumVerbose, perform_checksum_validation,
};
use uucore::checksum::{
AlgoKind, ChecksumError, SizedAlgoKind, calculate_blake2b_length_str,
sanitize_sha2_sha3_length_str,
};
use uucore::checksum::{AlgoKind, ChecksumError, SizedAlgoKind, calculate_blake2b_length_str};
use uucore::error::UResult;
use uucore::line_ending::LineEnding;
use uucore::{format_usage, translate};
Expand Down Expand Up @@ -72,36 +69,6 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<(AlgoKind, Optio
if matches.get_flag("b2sum") {
set_or_err((AlgoKind::Blake2b, None))?;
}
if matches.get_flag("b3sum") {
set_or_err((AlgoKind::Blake3, None))?;
}
if matches.get_flag("sha3") {
match matches.get_one::<String>(options::LENGTH) {
Some(len) => set_or_err((
AlgoKind::Sha3,
Some(sanitize_sha2_sha3_length_str(AlgoKind::Sha3, len)?),
))?,
None => return Err(ChecksumError::LengthRequired("SHA3".into()).into()),
}
}
if matches.get_flag("sha3-224") {
set_or_err((AlgoKind::Sha3, Some(224)))?;
}
if matches.get_flag("sha3-256") {
set_or_err((AlgoKind::Sha3, Some(256)))?;
}
if matches.get_flag("sha3-384") {
set_or_err((AlgoKind::Sha3, Some(384)))?;
}
if matches.get_flag("sha3-512") {
set_or_err((AlgoKind::Sha3, Some(512)))?;
}
if matches.get_flag("shake128") {
set_or_err((AlgoKind::Shake128, Some(128)))?;
}
if matches.get_flag("shake256") {
set_or_err((AlgoKind::Shake256, Some(256)))?;
}

if alg.is_none() {
return Err(ChecksumError::NeedAlgorithmToHash.into());
Expand Down Expand Up @@ -372,15 +339,7 @@ pub fn uu_app_custom() -> Command {
("sha256", translate!("hashsum-help-sha256")),
("sha384", translate!("hashsum-help-sha384")),
("sha512", translate!("hashsum-help-sha512")),
("sha3", translate!("hashsum-help-sha3")),
("sha3-224", translate!("hashsum-help-sha3-224")),
("sha3-256", translate!("hashsum-help-sha3-256")),
("sha3-384", translate!("hashsum-help-sha3-384")),
("sha3-512", translate!("hashsum-help-sha3-512")),
("shake128", translate!("hashsum-help-shake128")),
("shake256", translate!("hashsum-help-shake256")),
("b2sum", translate!("hashsum-help-b2sum")),
("b3sum", translate!("hashsum-help-b3sum")),
];

for (name, desc) in algorithms {
Expand Down
8 changes: 0 additions & 8 deletions tests/by-util/test_hashsum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,10 @@ macro_rules! test_digest_with_len {

test_digest! {md5, md5}
test_digest! {sha1, sha1}
test_digest! {b3sum, b3sum}
test_digest! {shake128, shake128}
test_digest! {shake256, shake256}

test_digest_with_len! {sha224, sha224, 224}
test_digest_with_len! {sha256, sha256, 256}
test_digest_with_len! {sha384, sha384, 384}
test_digest_with_len! {sha512, sha512, 512}
test_digest_with_len! {sha3_224, sha3, 224}
test_digest_with_len! {sha3_256, sha3, 256}
test_digest_with_len! {sha3_384, sha3, 384}
test_digest_with_len! {sha3_512, sha3, 512}
test_digest_with_len! {b2sum, b2sum, 512}

#[test]
Expand Down
Loading