mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
Merge pull request #9035 from RenjiSann/cksum-fix-sha2-sha3
Some checks failed
Check uudoc Documentation Generation / Verify uudoc generates correct documentation (push) Has been cancelled
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
Some checks failed
Check uudoc Documentation Generation / Verify uudoc generates correct documentation (push) Has been cancelled
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
cksum: Add support for sha2, sha3
This commit is contained in:
commit
0be1ac88c4
30 changed files with 491 additions and 126 deletions
|
|
@ -8,10 +8,8 @@ cksum-after-help = DIGEST determines the digest algorithm and default output for
|
|||
- crc32b: (only available through cksum)
|
||||
- md5: (equivalent to md5sum)
|
||||
- sha1: (equivalent to sha1sum)
|
||||
- sha224: (equivalent to sha224sum)
|
||||
- sha256: (equivalent to sha256sum)
|
||||
- sha384: (equivalent to sha384sum)
|
||||
- sha512: (equivalent to sha512sum)
|
||||
- sha2: (equivalent to sha{"{224,256,384,512}"}sum)
|
||||
- sha3: (only available through cksum)
|
||||
- blake2b: (equivalent to b2sum)
|
||||
- sm3: (only available through cksum)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ cksum-after-help = DIGEST détermine l'algorithme de condensé et le format de s
|
|||
- crc32b : (disponible uniquement via cksum)
|
||||
- md5 : (équivalent à md5sum)
|
||||
- sha1 : (équivalent à sha1sum)
|
||||
- sha224 : (équivalent à sha224sum)
|
||||
- sha256 : (équivalent à sha256sum)
|
||||
- sha384 : (équivalent à sha384sum)
|
||||
- sha512 : (équivalent à sha512sum)
|
||||
- sha2: (équivalent à sha{"{224,256,384,512}"}sum)
|
||||
- sha3 : (disponible uniquement via cksum)
|
||||
- blake2b : (équivalent à b2sum)
|
||||
- sm3 : (disponible uniquement via cksum)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@ use std::iter;
|
|||
use std::path::Path;
|
||||
use uucore::checksum::{
|
||||
ALGORITHM_OPTIONS_BLAKE2B, ALGORITHM_OPTIONS_BSD, ALGORITHM_OPTIONS_CRC,
|
||||
ALGORITHM_OPTIONS_CRC32B, ALGORITHM_OPTIONS_SYSV, ChecksumError, ChecksumOptions,
|
||||
ChecksumVerbose, HashAlgorithm, LEGACY_ALGORITHMS, SUPPORTED_ALGORITHMS,
|
||||
calculate_blake2b_length, detect_algo, digest_reader, perform_checksum_validation,
|
||||
ALGORITHM_OPTIONS_CRC32B, ALGORITHM_OPTIONS_SHA2, ALGORITHM_OPTIONS_SHA3,
|
||||
ALGORITHM_OPTIONS_SYSV, ChecksumError, ChecksumOptions, ChecksumVerbose, HashAlgorithm,
|
||||
LEGACY_ALGORITHMS, SUPPORTED_ALGORITHMS, calculate_blake2b_length, detect_algo, digest_reader,
|
||||
perform_checksum_validation,
|
||||
};
|
||||
use uucore::translate;
|
||||
|
||||
|
|
@ -382,13 +383,16 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
let input_length = matches.get_one::<usize>(options::LENGTH);
|
||||
|
||||
let length = match input_length {
|
||||
None | Some(0) => None,
|
||||
Some(length) if algo_name == ALGORITHM_OPTIONS_BLAKE2B => {
|
||||
calculate_blake2b_length(*length)?
|
||||
}
|
||||
let length = match (input_length, algo_name) {
|
||||
// Length for sha2 and sha3 should be saved, it will be validated
|
||||
// afterwards if necessary.
|
||||
(Some(len), ALGORITHM_OPTIONS_SHA2 | ALGORITHM_OPTIONS_SHA3) => Some(*len),
|
||||
(None | Some(0), _) => None,
|
||||
// Length for Blake2b if saved only if it's not zero.
|
||||
(Some(len), ALGORITHM_OPTIONS_BLAKE2B) => calculate_blake2b_length(*len)?,
|
||||
// a --length flag set with any other algorithm is an error.
|
||||
_ => {
|
||||
return Err(ChecksumError::LengthOnlyForBlake2b.into());
|
||||
return Err(ChecksumError::LengthOnlyForBlake2bSha2Sha3.into());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<HashAlgorithm> {
|
|||
if matches.get_flag("sha3") {
|
||||
match matches.get_one::<usize>("bits") {
|
||||
Some(bits) => set_or_err(create_sha3(*bits)?)?,
|
||||
None => return Err(ChecksumError::BitsRequiredForSha3.into()),
|
||||
None => return Err(ChecksumError::LengthRequired("SHA3".into()).into()),
|
||||
}
|
||||
}
|
||||
if matches.get_flag("sha3-224") {
|
||||
|
|
@ -139,7 +139,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<HashAlgorithm> {
|
|||
create_fn: Box::new(|| Box::new(Shake128::new())),
|
||||
bits: *bits,
|
||||
})?,
|
||||
None => return Err(ChecksumError::BitsRequiredForShake128.into()),
|
||||
None => return Err(ChecksumError::LengthRequired("SHAKE128".into()).into()),
|
||||
}
|
||||
}
|
||||
if matches.get_flag("shake256") {
|
||||
|
|
@ -149,7 +149,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<HashAlgorithm> {
|
|||
create_fn: Box::new(|| Box::new(Shake256::new())),
|
||||
bits: *bits,
|
||||
})?,
|
||||
None => return Err(ChecksumError::BitsRequiredForShake256.into()),
|
||||
None => return Err(ChecksumError::LengthRequired("SHAKE256".into()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ pub const ALGORITHM_OPTIONS_CRC: &str = "crc";
|
|||
pub const ALGORITHM_OPTIONS_CRC32B: &str = "crc32b";
|
||||
pub const ALGORITHM_OPTIONS_MD5: &str = "md5";
|
||||
pub const ALGORITHM_OPTIONS_SHA1: &str = "sha1";
|
||||
pub const ALGORITHM_OPTIONS_SHA2: &str = "sha2";
|
||||
pub const ALGORITHM_OPTIONS_SHA3: &str = "sha3";
|
||||
|
||||
pub const ALGORITHM_OPTIONS_SHA224: &str = "sha224";
|
||||
|
|
@ -47,21 +48,23 @@ pub const ALGORITHM_OPTIONS_SM3: &str = "sm3";
|
|||
pub const ALGORITHM_OPTIONS_SHAKE128: &str = "shake128";
|
||||
pub const ALGORITHM_OPTIONS_SHAKE256: &str = "shake256";
|
||||
|
||||
pub const SUPPORTED_ALGORITHMS: [&str; 16] = [
|
||||
pub const SUPPORTED_ALGORITHMS: [&str; 17] = [
|
||||
ALGORITHM_OPTIONS_SYSV,
|
||||
ALGORITHM_OPTIONS_BSD,
|
||||
ALGORITHM_OPTIONS_CRC,
|
||||
ALGORITHM_OPTIONS_CRC32B,
|
||||
ALGORITHM_OPTIONS_MD5,
|
||||
ALGORITHM_OPTIONS_SHA1,
|
||||
ALGORITHM_OPTIONS_SHA2,
|
||||
ALGORITHM_OPTIONS_SHA3,
|
||||
ALGORITHM_OPTIONS_BLAKE2B,
|
||||
ALGORITHM_OPTIONS_SM3,
|
||||
// Extra algorithms that are not valid `cksum --algorithm`
|
||||
ALGORITHM_OPTIONS_SHA224,
|
||||
ALGORITHM_OPTIONS_SHA256,
|
||||
ALGORITHM_OPTIONS_SHA384,
|
||||
ALGORITHM_OPTIONS_SHA512,
|
||||
ALGORITHM_OPTIONS_BLAKE2B,
|
||||
ALGORITHM_OPTIONS_BLAKE3,
|
||||
ALGORITHM_OPTIONS_SM3,
|
||||
ALGORITHM_OPTIONS_SHAKE128,
|
||||
ALGORITHM_OPTIONS_SHAKE256,
|
||||
];
|
||||
|
|
@ -215,20 +218,16 @@ pub enum ChecksumError {
|
|||
StrictNotCheck,
|
||||
#[error("the --quiet option is meaningful only when verifying checksums")]
|
||||
QuietNotCheck,
|
||||
#[error("Invalid output size for SHA3 (expected 224, 256, 384, or 512)")]
|
||||
InvalidOutputSizeForSha3,
|
||||
#[error("--bits required for SHA3")]
|
||||
BitsRequiredForSha3,
|
||||
#[error("--bits required for SHAKE128")]
|
||||
BitsRequiredForShake128,
|
||||
#[error("--bits required for SHAKE256")]
|
||||
BitsRequiredForShake256,
|
||||
#[error("unknown algorithm: clap should have prevented this case")]
|
||||
UnknownAlgorithm,
|
||||
#[error("--length required for {}", .0.quote())]
|
||||
LengthRequired(String),
|
||||
#[error("unknown algorithm: {0}: clap should have prevented this case")]
|
||||
UnknownAlgorithm(String),
|
||||
#[error("length is not a multiple of 8")]
|
||||
InvalidLength,
|
||||
#[error("--length is only supported with --algorithm=blake2b")]
|
||||
LengthOnlyForBlake2b,
|
||||
#[error("digest length for {} must be 224, 256, 384, or 512", .0.quote())]
|
||||
InvalidLengthFor(String),
|
||||
#[error("--length is only supported with --algorithm blake2b, sha2, or sha3")]
|
||||
LengthOnlyForBlake2bSha2Sha3,
|
||||
#[error("the --binary and --text options are meaningless when verifying checksums")]
|
||||
BinaryTextConflict,
|
||||
#[error("--text mode is only supported with --untagged")]
|
||||
|
|
@ -258,27 +257,54 @@ impl UError for ChecksumError {
|
|||
pub fn create_sha3(bits: usize) -> UResult<HashAlgorithm> {
|
||||
match bits {
|
||||
224 => Ok(HashAlgorithm {
|
||||
name: "SHA3_224",
|
||||
name: "SHA3-224",
|
||||
create_fn: Box::new(|| Box::new(Sha3_224::new())),
|
||||
bits: 224,
|
||||
}),
|
||||
256 => Ok(HashAlgorithm {
|
||||
name: "SHA3_256",
|
||||
name: "SHA3-256",
|
||||
create_fn: Box::new(|| Box::new(Sha3_256::new())),
|
||||
bits: 256,
|
||||
}),
|
||||
384 => Ok(HashAlgorithm {
|
||||
name: "SHA3_384",
|
||||
name: "SHA3-384",
|
||||
create_fn: Box::new(|| Box::new(Sha3_384::new())),
|
||||
bits: 384,
|
||||
}),
|
||||
512 => Ok(HashAlgorithm {
|
||||
name: "SHA3_512",
|
||||
name: "SHA3-512",
|
||||
create_fn: Box::new(|| Box::new(Sha3_512::new())),
|
||||
bits: 512,
|
||||
}),
|
||||
|
||||
_ => Err(ChecksumError::InvalidOutputSizeForSha3.into()),
|
||||
_ => Err(ChecksumError::InvalidLengthFor("SHA3".into()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_sha2(bits: usize) -> UResult<HashAlgorithm> {
|
||||
match bits {
|
||||
224 => Ok(HashAlgorithm {
|
||||
name: "SHA224",
|
||||
create_fn: Box::new(|| Box::new(Sha224::new())),
|
||||
bits: 224,
|
||||
}),
|
||||
256 => Ok(HashAlgorithm {
|
||||
name: "SHA256",
|
||||
create_fn: Box::new(|| Box::new(Sha256::new())),
|
||||
bits: 256,
|
||||
}),
|
||||
384 => Ok(HashAlgorithm {
|
||||
name: "SHA384",
|
||||
create_fn: Box::new(|| Box::new(Sha384::new())),
|
||||
bits: 384,
|
||||
}),
|
||||
512 => Ok(HashAlgorithm {
|
||||
name: "SHA512",
|
||||
create_fn: Box::new(|| Box::new(Sha512::new())),
|
||||
bits: 512,
|
||||
}),
|
||||
|
||||
_ => Err(ChecksumError::InvalidLengthFor("SHA2".into()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,26 +424,10 @@ pub fn detect_algo(algo: &str, length: Option<usize>) -> UResult<HashAlgorithm>
|
|||
create_fn: Box::new(|| Box::new(Sha1::new())),
|
||||
bits: 160,
|
||||
}),
|
||||
ALGORITHM_OPTIONS_SHA224 | "sha224sum" => Ok(HashAlgorithm {
|
||||
name: ALGORITHM_OPTIONS_SHA224,
|
||||
create_fn: Box::new(|| Box::new(Sha224::new())),
|
||||
bits: 224,
|
||||
}),
|
||||
ALGORITHM_OPTIONS_SHA256 | "sha256sum" => Ok(HashAlgorithm {
|
||||
name: ALGORITHM_OPTIONS_SHA256,
|
||||
create_fn: Box::new(|| Box::new(Sha256::new())),
|
||||
bits: 256,
|
||||
}),
|
||||
ALGORITHM_OPTIONS_SHA384 | "sha384sum" => Ok(HashAlgorithm {
|
||||
name: ALGORITHM_OPTIONS_SHA384,
|
||||
create_fn: Box::new(|| Box::new(Sha384::new())),
|
||||
bits: 384,
|
||||
}),
|
||||
ALGORITHM_OPTIONS_SHA512 | "sha512sum" => Ok(HashAlgorithm {
|
||||
name: ALGORITHM_OPTIONS_SHA512,
|
||||
create_fn: Box::new(|| Box::new(Sha512::new())),
|
||||
bits: 512,
|
||||
}),
|
||||
ALGORITHM_OPTIONS_SHA224 | "sha224sum" => Ok(create_sha2(224)?),
|
||||
ALGORITHM_OPTIONS_SHA256 | "sha256sum" => Ok(create_sha2(256)?),
|
||||
ALGORITHM_OPTIONS_SHA384 | "sha384sum" => Ok(create_sha2(384)?),
|
||||
ALGORITHM_OPTIONS_SHA512 | "sha512sum" => Ok(create_sha2(512)?),
|
||||
ALGORITHM_OPTIONS_BLAKE2B | "b2sum" => {
|
||||
// Set default length to 512 if None
|
||||
let bits = length.unwrap_or(512);
|
||||
|
|
@ -445,28 +455,38 @@ pub fn detect_algo(algo: &str, length: Option<usize>) -> UResult<HashAlgorithm>
|
|||
create_fn: Box::new(|| Box::new(Sm3::new())),
|
||||
bits: 512,
|
||||
}),
|
||||
ALGORITHM_OPTIONS_SHAKE128 | "shake128sum" => {
|
||||
let bits = length.ok_or(ChecksumError::BitsRequiredForShake128)?;
|
||||
algo @ (ALGORITHM_OPTIONS_SHAKE128 | "shake128sum") => {
|
||||
let bits = length.ok_or(ChecksumError::LengthRequired(algo.to_ascii_uppercase()))?;
|
||||
Ok(HashAlgorithm {
|
||||
name: ALGORITHM_OPTIONS_SHAKE128,
|
||||
create_fn: Box::new(|| Box::new(Shake128::new())),
|
||||
bits,
|
||||
})
|
||||
}
|
||||
ALGORITHM_OPTIONS_SHAKE256 | "shake256sum" => {
|
||||
let bits = length.ok_or(ChecksumError::BitsRequiredForShake256)?;
|
||||
algo @ (ALGORITHM_OPTIONS_SHAKE256 | "shake256sum") => {
|
||||
let bits = length.ok_or(ChecksumError::LengthRequired(algo.to_ascii_uppercase()))?;
|
||||
Ok(HashAlgorithm {
|
||||
name: ALGORITHM_OPTIONS_SHAKE256,
|
||||
create_fn: Box::new(|| Box::new(Shake256::new())),
|
||||
bits,
|
||||
})
|
||||
}
|
||||
_ if algo.starts_with("sha3") => {
|
||||
let bits = length.ok_or(ChecksumError::BitsRequiredForSha3)?;
|
||||
algo @ ALGORITHM_OPTIONS_SHA2 => {
|
||||
let bits = validate_sha2_sha3_length(algo, length)?;
|
||||
create_sha2(bits)
|
||||
}
|
||||
algo @ ALGORITHM_OPTIONS_SHA3 => {
|
||||
let bits = validate_sha2_sha3_length(algo, length)?;
|
||||
create_sha3(bits)
|
||||
}
|
||||
|
||||
_ => Err(ChecksumError::UnknownAlgorithm.into()),
|
||||
// TODO: `hashsum` specific, to remove once hashsum is removed.
|
||||
algo @ ("sha3-224" | "sha3-256" | "sha3-384" | "sha3-512") => {
|
||||
let bits: usize = algo.strip_prefix("sha3-").unwrap().parse().unwrap();
|
||||
create_sha3(bits)
|
||||
}
|
||||
|
||||
algo => Err(ChecksumError::UnknownAlgorithm(algo.into()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -833,7 +853,9 @@ fn identify_algo_name_and_length(
|
|||
}
|
||||
|
||||
let bytes = if let Some(bitlen) = line_info.algo_bit_len {
|
||||
if algorithm != ALGORITHM_OPTIONS_BLAKE2B || bitlen % 8 != 0 {
|
||||
match algorithm.as_str() {
|
||||
ALGORITHM_OPTIONS_BLAKE2B if bitlen % 8 == 0 => Some(bitlen / 8),
|
||||
ALGORITHM_OPTIONS_SHA3 if [224, 256, 384, 512].contains(&bitlen) => Some(bitlen),
|
||||
// Either
|
||||
// the algo based line is provided with a bit length
|
||||
// with an algorithm that does not support it (only Blake2B does).
|
||||
|
|
@ -842,9 +864,8 @@ fn identify_algo_name_and_length(
|
|||
// ^ This is illegal
|
||||
// OR
|
||||
// the given length is wrong because it's not a multiple of 8.
|
||||
return Err(LineCheckError::ImproperlyFormatted);
|
||||
_ => return Err(LineCheckError::ImproperlyFormatted),
|
||||
}
|
||||
Some(bitlen / 8)
|
||||
} else if algorithm == ALGORITHM_OPTIONS_BLAKE2B {
|
||||
// Default length with BLAKE2b,
|
||||
Some(64)
|
||||
|
|
@ -939,15 +960,24 @@ fn process_non_algo_based_line(
|
|||
let expected_checksum = get_expected_digest_as_hex_string(line_info, None)
|
||||
.ok_or(LineCheckError::ImproperlyFormatted)?;
|
||||
|
||||
// When a specific algorithm name is input, use it and use the provided bits
|
||||
// except when dealing with blake2b, where we will detect the length
|
||||
let (algo_name, algo_byte_len) = if cli_algo_name == ALGORITHM_OPTIONS_BLAKE2B {
|
||||
// division by 2 converts the length of the Blake2b checksum from hexadecimal
|
||||
// characters to bytes, as each byte is represented by two hexadecimal characters.
|
||||
let length = Some(expected_checksum.len() / 2);
|
||||
(ALGORITHM_OPTIONS_BLAKE2B.to_string(), length)
|
||||
} else {
|
||||
(cli_algo_name.to_lowercase(), cli_algo_length)
|
||||
// When a specific algorithm name is input, use it and use the provided
|
||||
// bits except when dealing with blake2b, sha2 and sha3, where we will
|
||||
// detect the length.
|
||||
let (algo_name, algo_byte_len) = match cli_algo_name {
|
||||
ALGORITHM_OPTIONS_BLAKE2B => {
|
||||
// division by 2 converts the length of the Blake2b checksum from
|
||||
// hexadecimal characters to bytes, as each byte is represented by
|
||||
// two hexadecimal characters.
|
||||
(
|
||||
ALGORITHM_OPTIONS_BLAKE2B.to_string(),
|
||||
Some(expected_checksum.len() / 2),
|
||||
)
|
||||
}
|
||||
algo @ (ALGORITHM_OPTIONS_SHA2 | ALGORITHM_OPTIONS_SHA3) => {
|
||||
// multiplication by 4 to get the number of bits
|
||||
(algo.to_string(), Some(expected_checksum.len() * 4))
|
||||
}
|
||||
_ => (cli_algo_name.to_lowercase(), cli_algo_length),
|
||||
};
|
||||
|
||||
let algo = detect_algo(&algo_name, algo_byte_len)?;
|
||||
|
|
@ -1216,6 +1246,17 @@ pub fn calculate_blake2b_length(length: usize) -> UResult<Option<usize>> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn validate_sha2_sha3_length(algo_name: &str, length: Option<usize>) -> UResult<usize> {
|
||||
match length {
|
||||
Some(len @ (224 | 256 | 384 | 512)) => Ok(len),
|
||||
Some(len) => {
|
||||
show_error!("invalid length: '{len}'");
|
||||
Err(ChecksumError::InvalidLengthFor(algo_name.to_ascii_uppercase()).into())
|
||||
}
|
||||
None => Err(ChecksumError::LengthRequired(algo_name.to_ascii_uppercase()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unescape_filename(filename: &[u8]) -> (Vec<u8>, &'static str) {
|
||||
let mut unescaped = Vec::with_capacity(filename.len());
|
||||
let mut byte_iter = filename.iter().peekable();
|
||||
|
|
@ -1327,19 +1368,19 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
detect_algo(ALGORITHM_OPTIONS_SHA224, None).unwrap().name,
|
||||
ALGORITHM_OPTIONS_SHA224
|
||||
ALGORITHM_OPTIONS_SHA224.to_ascii_uppercase()
|
||||
);
|
||||
assert_eq!(
|
||||
detect_algo(ALGORITHM_OPTIONS_SHA256, None).unwrap().name,
|
||||
ALGORITHM_OPTIONS_SHA256
|
||||
ALGORITHM_OPTIONS_SHA256.to_ascii_uppercase()
|
||||
);
|
||||
assert_eq!(
|
||||
detect_algo(ALGORITHM_OPTIONS_SHA384, None).unwrap().name,
|
||||
ALGORITHM_OPTIONS_SHA384
|
||||
ALGORITHM_OPTIONS_SHA384.to_ascii_uppercase()
|
||||
);
|
||||
assert_eq!(
|
||||
detect_algo(ALGORITHM_OPTIONS_SHA512, None).unwrap().name,
|
||||
ALGORITHM_OPTIONS_SHA512
|
||||
ALGORITHM_OPTIONS_SHA512.to_ascii_uppercase()
|
||||
);
|
||||
assert_eq!(
|
||||
detect_algo(ALGORITHM_OPTIONS_BLAKE2B, None).unwrap().name,
|
||||
|
|
@ -1365,12 +1406,35 @@ mod tests {
|
|||
.name,
|
||||
ALGORITHM_OPTIONS_SHAKE256
|
||||
);
|
||||
assert_eq!(detect_algo("sha3_224", Some(224)).unwrap().name, "SHA3_224");
|
||||
assert_eq!(detect_algo("sha3_256", Some(256)).unwrap().name, "SHA3_256");
|
||||
assert_eq!(detect_algo("sha3_384", Some(384)).unwrap().name, "SHA3_384");
|
||||
assert_eq!(detect_algo("sha3_512", Some(512)).unwrap().name, "SHA3_512");
|
||||
|
||||
assert!(detect_algo("sha3_512", None).is_err());
|
||||
// Older versions of checksum used to detect the "sha3" prefix, but not
|
||||
// anymore.
|
||||
assert!(detect_algo("sha3_224", Some(224)).is_err());
|
||||
assert!(detect_algo("sha3_256", Some(256)).is_err());
|
||||
assert!(detect_algo("sha3_384", Some(384)).is_err());
|
||||
assert!(detect_algo("sha3_512", Some(512)).is_err());
|
||||
|
||||
let sha3_224 = detect_algo("sha3", Some(224)).unwrap();
|
||||
assert_eq!(sha3_224.name, "SHA3-224");
|
||||
assert_eq!(sha3_224.bits, 224);
|
||||
let sha3_256 = detect_algo("sha3", Some(256)).unwrap();
|
||||
assert_eq!(sha3_256.name, "SHA3-256");
|
||||
assert_eq!(sha3_256.bits, 256);
|
||||
let sha3_384 = detect_algo("sha3", Some(384)).unwrap();
|
||||
assert_eq!(sha3_384.name, "SHA3-384");
|
||||
assert_eq!(sha3_384.bits, 384);
|
||||
let sha3_512 = detect_algo("sha3", Some(512)).unwrap();
|
||||
assert_eq!(sha3_512.name, "SHA3-512");
|
||||
assert_eq!(sha3_512.bits, 512);
|
||||
|
||||
assert!(detect_algo("sha3", None).is_err());
|
||||
|
||||
assert_eq!(detect_algo("sha2", Some(224)).unwrap().name, "SHA224");
|
||||
assert_eq!(detect_algo("sha2", Some(256)).unwrap().name, "SHA256");
|
||||
assert_eq!(detect_algo("sha2", Some(384)).unwrap().name, "SHA384");
|
||||
assert_eq!(detect_algo("sha2", Some(512)).unwrap().name, "SHA512");
|
||||
|
||||
assert!(detect_algo("sha2", None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use uutests::util_name;
|
|||
const ALGOS: [&str; 11] = [
|
||||
"sysv", "bsd", "crc", "md5", "sha1", "sha224", "sha256", "sha384", "sha512", "blake2b", "sm3",
|
||||
];
|
||||
const SHA_LENGTHS: [u32; 4] = [224, 256, 384, 512];
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
|
|
@ -118,9 +119,7 @@ fn test_one_nonexisting_file() {
|
|||
// but <128 bytes (1 fold pclmul) // spell-checker:disable-line
|
||||
#[test]
|
||||
fn test_crc_for_bigger_than_32_bytes() {
|
||||
let (_, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let result = ucmd.arg("chars.txt").succeeds();
|
||||
let result = new_ucmd!().arg("chars.txt").succeeds();
|
||||
|
||||
let mut stdout_split = result.stdout_str().split(' ');
|
||||
|
||||
|
|
@ -133,9 +132,7 @@ fn test_crc_for_bigger_than_32_bytes() {
|
|||
|
||||
#[test]
|
||||
fn test_stdin_larger_than_128_bytes() {
|
||||
let (_, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let result = ucmd.arg("larger_than_2056_bytes.txt").succeeds();
|
||||
let result = new_ucmd!().arg("larger_than_2056_bytes.txt").succeeds();
|
||||
|
||||
let mut stdout_split = result.stdout_str().split(' ');
|
||||
|
||||
|
|
@ -296,36 +293,300 @@ fn test_untagged_algorithm_stdin() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha2_wrong_length() {
|
||||
for l in [0, 13, 819_111_123] {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains(format!("invalid length: '{l}'"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha2_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("sha{l}_single_file.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha2_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.arg("alice_in_wonderland.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("sha{l}_multiple_files.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha2_stdin() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.pipe_in_fixture("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("sha{l}_stdin.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_untagged_sha2_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--untagged")
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("untagged/sha{l}_single_file.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_untagged_sha2_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--untagged")
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.arg("alice_in_wonderland.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("untagged/sha{l}_multiple_files.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_untagged_sha2_stdin() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--untagged")
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("--length={l}"))
|
||||
.pipe_in_fixture("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("untagged/sha{l}_stdin.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_tagged_sha2_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg(format!("sha{l}_single_file.expected"))
|
||||
.succeeds()
|
||||
.stdout_is("lorem_ipsum.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_tagged_sha2_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg(format!("sha{l}_multiple_files.expected"))
|
||||
.succeeds()
|
||||
.stdout_contains("lorem_ipsum.txt: OK\n")
|
||||
.stdout_contains("alice_in_wonderland.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
// When checking sha2 in untagged mode, the length is automatically deduced
|
||||
// from the length of the digest.
|
||||
#[test]
|
||||
fn test_check_untagged_sha2_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("untagged/sha{l}_single_file.expected"))
|
||||
.succeeds()
|
||||
.stdout_is("lorem_ipsum.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_untagged_sha2_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg("--algorithm=sha2")
|
||||
.arg(format!("untagged/sha{l}_multiple_files.expected"))
|
||||
.succeeds()
|
||||
.stdout_contains("lorem_ipsum.txt: OK\n")
|
||||
.stdout_contains("alice_in_wonderland.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha3_wrong_length() {
|
||||
for l in [0, 13, 819_111_123] {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains(format!("invalid length: '{l}'"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha3_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("sha3_{l}_single_file.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha3_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.arg("alice_in_wonderland.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("sha3_{l}_multiple_files.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha3_stdin() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.pipe_in_fixture("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("sha3_{l}_stdin.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_untagged_sha3_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--untagged")
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("untagged/sha3_{l}_single_file.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_untagged_sha3_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--untagged")
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.arg("lorem_ipsum.txt")
|
||||
.arg("alice_in_wonderland.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("untagged/sha3_{l}_multiple_files.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_untagged_sha3_stdin() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--untagged")
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("--length={l}"))
|
||||
.pipe_in_fixture("lorem_ipsum.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture(format!("untagged/sha3_{l}_stdin.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_tagged_sha3_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg(format!("sha3_{l}_single_file.expected"))
|
||||
.succeeds()
|
||||
.stdout_is("lorem_ipsum.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_tagged_sha3_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg(format!("sha3_{l}_multiple_files.expected"))
|
||||
.succeeds()
|
||||
.stdout_contains("lorem_ipsum.txt: OK\n")
|
||||
.stdout_contains("alice_in_wonderland.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
// When checking sha3 in untagged mode, the length is automatically deduced
|
||||
// from the length of the digest.
|
||||
#[test]
|
||||
fn test_check_untagged_sha3_single_file() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("untagged/sha3_{l}_single_file.expected"))
|
||||
.succeeds()
|
||||
.stdout_is("lorem_ipsum.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_untagged_sha3_multiple_files() {
|
||||
for l in SHA_LENGTHS {
|
||||
new_ucmd!()
|
||||
.arg("--check")
|
||||
.arg("--algorithm=sha3")
|
||||
.arg(format!("untagged/sha3_{l}_multiple_files.expected"))
|
||||
.succeeds()
|
||||
.stdout_contains("lorem_ipsum.txt: OK\n")
|
||||
.stdout_contains("alice_in_wonderland.txt: OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_algo() {
|
||||
new_ucmd!()
|
||||
.arg("-a=bsd")
|
||||
.arg("--check")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --check is not supported with --algorithm={bsd,sysv,crc,crc32b}");
|
||||
new_ucmd!()
|
||||
.arg("-a=sysv")
|
||||
.arg("--check")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --check is not supported with --algorithm={bsd,sysv,crc,crc32b}");
|
||||
new_ucmd!()
|
||||
.arg("-a=crc")
|
||||
.arg("--check")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --check is not supported with --algorithm={bsd,sysv,crc,crc32b}");
|
||||
new_ucmd!()
|
||||
.arg("-a=crc32b")
|
||||
.arg("--check")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --check is not supported with --algorithm={bsd,sysv,crc,crc32b}");
|
||||
for algo in ["bsd", "sysv", "crc", "crc32b"] {
|
||||
new_ucmd!()
|
||||
.arg("-a")
|
||||
.arg(algo)
|
||||
.arg("--check")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains(
|
||||
"cksum: --check is not supported with --algorithm={bsd,sysv,crc,crc32b}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -336,7 +597,9 @@ fn test_length_with_wrong_algorithm() {
|
|||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --length is only supported with --algorithm=blake2b");
|
||||
.stderr_contains(
|
||||
"cksum: --length is only supported with --algorithm blake2b, sha2, or sha3",
|
||||
);
|
||||
|
||||
new_ucmd!()
|
||||
.arg("--length=16")
|
||||
|
|
@ -345,7 +608,9 @@ fn test_length_with_wrong_algorithm() {
|
|||
.arg("foo.sums")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --length is only supported with --algorithm=blake2b");
|
||||
.stderr_contains(
|
||||
"cksum: --length is only supported with --algorithm blake2b, sha2, or sha3",
|
||||
);
|
||||
}
|
||||
|
||||
/// Giving --length to a wrong algorithm doesn't fail if the length is zero
|
||||
|
|
@ -369,7 +634,9 @@ fn test_length_not_supported() {
|
|||
.arg("lorem_ipsum.txt")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("--length is only supported with --algorithm=blake2b");
|
||||
.stderr_contains(
|
||||
"cksum: --length is only supported with --algorithm blake2b, sha2, or sha3",
|
||||
);
|
||||
|
||||
new_ucmd!()
|
||||
.arg("-l")
|
||||
|
|
@ -380,7 +647,9 @@ fn test_length_not_supported() {
|
|||
.arg("/tmp/xxx")
|
||||
.fails_with_code(1)
|
||||
.no_stdout()
|
||||
.stderr_contains("--length is only supported with --algorithm=blake2b");
|
||||
.stderr_contains(
|
||||
"cksum: --length is only supported with --algorithm blake2b, sha2, or sha3",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
2
tests/fixtures/cksum/sha3_224_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/sha3_224_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SHA3-224 (lorem_ipsum.txt) = 00cf719da146d5f51f8969cb518aa2cb89dae71e0aad979b30398f13
|
||||
SHA3-224 (alice_in_wonderland.txt) = 33882bd6f47b47648950b4d6c606240c257eeae73e67b96610fd092c
|
||||
1
tests/fixtures/cksum/sha3_224_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_224_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-224 (lorem_ipsum.txt) = 00cf719da146d5f51f8969cb518aa2cb89dae71e0aad979b30398f13
|
||||
1
tests/fixtures/cksum/sha3_224_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_224_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-224 (-) = 00cf719da146d5f51f8969cb518aa2cb89dae71e0aad979b30398f13
|
||||
2
tests/fixtures/cksum/sha3_256_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/sha3_256_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SHA3-256 (lorem_ipsum.txt) = c9b081db1c20bdb4d8f376f45b3fb412b48c75932451d13dd79bea61e7bddbe4
|
||||
SHA3-256 (alice_in_wonderland.txt) = 507e920028b617afd342fdd0da3096237d34e33e2490c38a743bf628124803ce
|
||||
1
tests/fixtures/cksum/sha3_256_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_256_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-256 (lorem_ipsum.txt) = c9b081db1c20bdb4d8f376f45b3fb412b48c75932451d13dd79bea61e7bddbe4
|
||||
1
tests/fixtures/cksum/sha3_256_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_256_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-256 (-) = c9b081db1c20bdb4d8f376f45b3fb412b48c75932451d13dd79bea61e7bddbe4
|
||||
2
tests/fixtures/cksum/sha3_384_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/sha3_384_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SHA3-384 (lorem_ipsum.txt) = 12e0dc8c08c0f84c5facbe95ece4e0b568b3b9fbe7dbd1a6751a118c2997aa70a78123cb3d6858dc31d353fc6b874bbe
|
||||
SHA3-384 (alice_in_wonderland.txt) = d999e51e60b98da41060c287f71592517554addc14b9d27cac3935b8b312fb1e3ffad2730a9cfe855cf0fdcbce6990c6
|
||||
1
tests/fixtures/cksum/sha3_384_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_384_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-384 (lorem_ipsum.txt) = 12e0dc8c08c0f84c5facbe95ece4e0b568b3b9fbe7dbd1a6751a118c2997aa70a78123cb3d6858dc31d353fc6b874bbe
|
||||
1
tests/fixtures/cksum/sha3_384_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_384_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-384 (-) = 12e0dc8c08c0f84c5facbe95ece4e0b568b3b9fbe7dbd1a6751a118c2997aa70a78123cb3d6858dc31d353fc6b874bbe
|
||||
2
tests/fixtures/cksum/sha3_512_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/sha3_512_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SHA3-512 (lorem_ipsum.txt) = 77f7bb7e1827d7735dd1fd8bc4f4fa3ae1168a1529118c74b18f9abe69a8aecfb60fff0ecec17d2860af90e257e4fbd90048978c47fdda94f56b2ffa1d06448f
|
||||
SHA3-512 (alice_in_wonderland.txt) = 029486dea9b2bc8a2c90d852982c3a5297e626ed31a956443c6cc4794874bf4fdca76006bacc407bc101c09f85ecb3cea468c17bdfe3ad0ccff03edd786e07a8
|
||||
1
tests/fixtures/cksum/sha3_512_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_512_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-512 (lorem_ipsum.txt) = 77f7bb7e1827d7735dd1fd8bc4f4fa3ae1168a1529118c74b18f9abe69a8aecfb60fff0ecec17d2860af90e257e4fbd90048978c47fdda94f56b2ffa1d06448f
|
||||
1
tests/fixtures/cksum/sha3_512_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/sha3_512_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
SHA3-512 (-) = 77f7bb7e1827d7735dd1fd8bc4f4fa3ae1168a1529118c74b18f9abe69a8aecfb60fff0ecec17d2860af90e257e4fbd90048978c47fdda94f56b2ffa1d06448f
|
||||
2
tests/fixtures/cksum/untagged/sha3_224_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/untagged/sha3_224_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
00cf719da146d5f51f8969cb518aa2cb89dae71e0aad979b30398f13 lorem_ipsum.txt
|
||||
33882bd6f47b47648950b4d6c606240c257eeae73e67b96610fd092c alice_in_wonderland.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_224_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_224_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
00cf719da146d5f51f8969cb518aa2cb89dae71e0aad979b30398f13 lorem_ipsum.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_224_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_224_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
00cf719da146d5f51f8969cb518aa2cb89dae71e0aad979b30398f13 -
|
||||
2
tests/fixtures/cksum/untagged/sha3_256_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/untagged/sha3_256_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
c9b081db1c20bdb4d8f376f45b3fb412b48c75932451d13dd79bea61e7bddbe4 lorem_ipsum.txt
|
||||
507e920028b617afd342fdd0da3096237d34e33e2490c38a743bf628124803ce alice_in_wonderland.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_256_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_256_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
c9b081db1c20bdb4d8f376f45b3fb412b48c75932451d13dd79bea61e7bddbe4 lorem_ipsum.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_256_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_256_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
c9b081db1c20bdb4d8f376f45b3fb412b48c75932451d13dd79bea61e7bddbe4 -
|
||||
2
tests/fixtures/cksum/untagged/sha3_384_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/untagged/sha3_384_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
12e0dc8c08c0f84c5facbe95ece4e0b568b3b9fbe7dbd1a6751a118c2997aa70a78123cb3d6858dc31d353fc6b874bbe lorem_ipsum.txt
|
||||
d999e51e60b98da41060c287f71592517554addc14b9d27cac3935b8b312fb1e3ffad2730a9cfe855cf0fdcbce6990c6 alice_in_wonderland.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_384_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_384_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
12e0dc8c08c0f84c5facbe95ece4e0b568b3b9fbe7dbd1a6751a118c2997aa70a78123cb3d6858dc31d353fc6b874bbe lorem_ipsum.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_384_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_384_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
12e0dc8c08c0f84c5facbe95ece4e0b568b3b9fbe7dbd1a6751a118c2997aa70a78123cb3d6858dc31d353fc6b874bbe -
|
||||
2
tests/fixtures/cksum/untagged/sha3_512_multiple_files.expected
vendored
Normal file
2
tests/fixtures/cksum/untagged/sha3_512_multiple_files.expected
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
77f7bb7e1827d7735dd1fd8bc4f4fa3ae1168a1529118c74b18f9abe69a8aecfb60fff0ecec17d2860af90e257e4fbd90048978c47fdda94f56b2ffa1d06448f lorem_ipsum.txt
|
||||
029486dea9b2bc8a2c90d852982c3a5297e626ed31a956443c6cc4794874bf4fdca76006bacc407bc101c09f85ecb3cea468c17bdfe3ad0ccff03edd786e07a8 alice_in_wonderland.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_512_single_file.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_512_single_file.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
77f7bb7e1827d7735dd1fd8bc4f4fa3ae1168a1529118c74b18f9abe69a8aecfb60fff0ecec17d2860af90e257e4fbd90048978c47fdda94f56b2ffa1d06448f lorem_ipsum.txt
|
||||
1
tests/fixtures/cksum/untagged/sha3_512_stdin.expected
vendored
Normal file
1
tests/fixtures/cksum/untagged/sha3_512_stdin.expected
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
77f7bb7e1827d7735dd1fd8bc4f4fa3ae1168a1529118c74b18f9abe69a8aecfb60fff0ecec17d2860af90e257e4fbd90048978c47fdda94f56b2ffa1d06448f -
|
||||
Loading…
Add table
Add a link
Reference in a new issue