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
103 changes: 103 additions & 0 deletions Cargo.lock

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

15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ feat_common_core = [
"basenc",
"cat",
"cksum",
"b2sum",
"md5sum",
"sha1sum",
"sha224sum",
"sha256sum",
"sha384sum",
"sha512sum",
"comm",
"cp",
"csplit",
Expand Down Expand Up @@ -404,6 +411,7 @@ uucore = { version = "0.5.0", package = "uucore", path = "src/uucore" }
uucore_procs = { version = "0.5.0", package = "uucore_procs", path = "src/uucore_procs" }
uu_ls = { version = "0.5.0", path = "src/uu/ls" }
uu_base32 = { version = "0.5.0", path = "src/uu/base32" }
uu_checksum_common = { version = "0.5.0", path = "src/uu/checksum_common" }
uutests = { version = "0.5.0", package = "uutests", path = "tests/uutests" }

[dependencies]
Expand Down Expand Up @@ -433,6 +441,13 @@ chmod = { optional = true, version = "0.5.0", package = "uu_chmod", path = "src/
chown = { optional = true, version = "0.5.0", package = "uu_chown", path = "src/uu/chown" }
chroot = { optional = true, version = "0.5.0", package = "uu_chroot", path = "src/uu/chroot" }
cksum = { optional = true, version = "0.5.0", package = "uu_cksum", path = "src/uu/cksum" }
b2sum = { optional = true, version = "0.5.0", package = "uu_b2sum", path = "src/uu/b2sum" }
md5sum = { optional = true, version = "0.5.0", package = "uu_md5sum", path = "src/uu/md5sum" }
sha1sum = { optional = true, version = "0.5.0", package = "uu_sha1sum", path = "src/uu/sha1sum" }
sha224sum = { optional = true, version = "0.5.0", package = "uu_sha224sum", path = "src/uu/sha224sum" }
sha256sum = { optional = true, version = "0.5.0", package = "uu_sha256sum", path = "src/uu/sha256sum" }
sha384sum = { optional = true, version = "0.5.0", package = "uu_sha384sum", path = "src/uu/sha384sum" }
sha512sum = { optional = true, version = "0.5.0", package = "uu_sha512sum", path = "src/uu/sha512sum" }
comm = { optional = true, version = "0.5.0", package = "uu_comm", path = "src/uu/comm" }
cp = { optional = true, version = "0.5.0", package = "uu_cp", path = "src/uu/cp" }
csplit = { optional = true, version = "0.5.0", package = "uu_csplit", path = "src/uu/csplit" }
Expand Down
23 changes: 14 additions & 9 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ PROGS := \
basename \
cat \
cksum \
b2sum \
md5sum \
sha1sum \
sha224sum \
sha256sum \
sha384sum \
sha512sum \
comm \
cp \
csplit \
Expand Down Expand Up @@ -184,15 +191,6 @@ SELINUX_PROGS := \
chcon \
runcon

HASHSUM_PROGS := \
b2sum \
md5sum \
sha1sum \
sha224sum \
sha256sum \
sha384sum \
sha512sum

$(info Detected OS = $(OS))

ifeq (,$(findstring MINGW,$(OS)))
Expand Down Expand Up @@ -223,6 +221,13 @@ TEST_PROGS := \
chmod \
chown \
cksum \
b2sum \
md5sum \
sha1sum \
sha224sum \
sha256sum \
sha384sum \
sha512sum \
comm \
cp \
csplit \
Expand Down
9 changes: 0 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ pub fn main() {
}
"hashsum" => {
phf_map.entry(krate, format!("({krate}::uumain, {krate}::uu_app_custom)"));

let map_value = format!("({krate}::uumain, {krate}::uu_app_common)");
phf_map.entry("md5sum", map_value.clone());
phf_map.entry("sha1sum", map_value.clone());
phf_map.entry("sha224sum", map_value.clone());
phf_map.entry("sha256sum", map_value.clone());
phf_map.entry("sha384sum", map_value.clone());
phf_map.entry("sha512sum", map_value.clone());
phf_map.entry("b2sum", map_value.clone());
}
_ => {
phf_map.entry(krate, map_value.clone());
Expand Down
10 changes: 10 additions & 0 deletions fuzz/Cargo.lock

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

6 changes: 0 additions & 6 deletions src/common/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ fn get_canonical_util_name(util_name: &str) -> &str {
// uu_test aliases - '[' is an alias for test
"[" => "test",

// hashsum aliases - all these hash commands are aliases for hashsum
"md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" | "b2sum" => {
"hashsum"
}

"dir" => "ls", // dir is an alias for ls

// Default case - return the util name as is
Expand Down Expand Up @@ -98,7 +93,6 @@ mod tests {
fn test_get_canonical_util_name() {
// Test a few key aliases
assert_eq!(get_canonical_util_name("["), "test");
assert_eq!(get_canonical_util_name("md5sum"), "hashsum");
assert_eq!(get_canonical_util_name("dir"), "ls");

// Test passthrough case
Expand Down
38 changes: 38 additions & 0 deletions src/uu/b2sum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "uu_b2sum"
description = "b2sum ~ (uutils) Print or check the BLAKE2b checksums"
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/b2sum"
version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
edition.workspace = true
readme.workspace = true

[lints]
workspace = true

[lib]
path = "src/b2sum.rs"

[dependencies]
clap = { workspace = true }
uu_checksum_common = { workspace = true }
uucore = { workspace = true, features = [
"checksum",
"encoding",
"sum",
"hardware",
] }
fluent = { workspace = true }

[dev-dependencies]
divan = { workspace = true }
tempfile = { workspace = true }
uucore = { workspace = true, features = ["benchmark"] }

[[bin]]
name = "b2sum"
path = "src/main.rs"
1 change: 1 addition & 0 deletions src/uu/b2sum/LICENSE
2 changes: 2 additions & 0 deletions src/uu/b2sum/locales/en-US.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
b2sum-about = Print or check the BLAKE2b checksums
b2sum-usage = b2sum [OPTIONS] [FILE]...
2 changes: 2 additions & 0 deletions src/uu/b2sum/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
b2sum-about = Afficher le BLAKE2b et la taille de chaque fichier
b2sum-usage = b2sum [OPTION]... [FICHIER]...
29 changes: 29 additions & 0 deletions src/uu/b2sum/src/b2sum.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

// spell-checker:ignore (ToDO) algo

use clap::Command;

use uu_checksum_common::{standalone_checksum_app_with_length, standalone_with_length_main};

use uucore::checksum::{AlgoKind, calculate_blake2b_length_str};
use uucore::error::UResult;
use uucore::translate;

#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
standalone_with_length_main(
AlgoKind::Blake2b,
uu_app(),
args,
calculate_blake2b_length_str,
)
}

#[inline]
pub fn uu_app() -> Command {
standalone_checksum_app_with_length(translate!("b2sum-about"), translate!("b2sum-usage"))
}
1 change: 1 addition & 0 deletions src/uu/b2sum/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uucore::bin!(uu_b2sum);
Loading
Loading