Skip to content

Commit

Permalink
b2sum: a new checksum utility with md5sum like interface
Browse files Browse the repository at this point in the history
Note we don't support the --algorithm option of the
b2sum command in the external BLAKE2 project, as that
was deemed too confusing for users.
"BLAKE2b" was chosen as the default algorithm to use,
which is single threaded but performs well on 64 bit.

* src/blake2: CC0 source copied from external project.
* cfg.mk[VC_LIST_ALWAYS_EXCLUDE_REGEX]: Exclude blake2/
from syntax checks, make update-copyright, etc.
* src/local.mk: Reference the sources for b2sum,
and set the compilation flags.
* doc/coreutils.texi (b2sum invocation): Reference the
md5sum invocation node, and add descriptions of -l.
* tests/misc/b2sum.sh: Add new test.
* tests/local.mk: Reference new test.
* AUTHORS: Add new binary.
* README: Likewise.
* build-aux/gen-lists-of-programs.sh: Likewise.
* man/.gitignore: Likewise.
* scripts/git-hooks/commit-msg: Likewise.
* man/b2sum.x: New man page template.
* man/local.mk: Reference new template.
* src/.gitignore: Ignore new binaries.
* src/blake2/.gitignore: Ignore new build atrifacts.
* src/md5sum.c (usage): Describe the new -l option.
* NEWS: Mention the new program.
  • Loading branch information
pixelb committed Nov 22, 2016
1 parent 373ba16 commit ea94589
Show file tree
Hide file tree
Showing 23 changed files with 1,428 additions and 24 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Here are the names of the programs in this package,
each followed by the name(s) of its author(s).

arch: David MacKenzie, Karel Zak
b2sum: Padraig Brady, Samuel Neves
base32: Simon Josefsson
base64: Simon Josefsson
basename: David MacKenzie
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ GNU coreutils NEWS -*- outline -*-
stat --format=%N for quoting file names now honors the
same QUOTING_STYLE environment variable values as ls.

** New programs

b2sum is added to support the BLAKE2 digest algorithm with
a similar interface to the existing md5sum and sha1sum, etc. commands.

** New Features

date now accepts the --debug option, to annotate the parsed date string,
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ arbitrary limits.

The programs that can be built with this package are:

[ arch base32 base64 basename cat chcon chgrp chmod chown chroot cksum comm
coreutils cp csplit cut date dd df dir dircolors dirname du echo env
[ arch b2sum base32 base64 basename cat chcon chgrp chmod chown chroot cksum
comm coreutils cp csplit cut date dd df dir dircolors dirname du echo env
expand expr factor false fmt fold groups head hostid hostname id install
join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl
nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd
Expand Down
1 change: 1 addition & 0 deletions THANKS.in
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ Ross Ridge rridge@calum.csclub.uwaterloo.ca
Rudolf Kastl rkastl@redhat.com
Sahil Amoli sahilamoli@gmail.com
Sami Farin sfarin@ratol.fi
Samuel Neves sneves@dei.uc.pt
Samuel Tardieu sam@rfc1149.net
Samuel Thibault samuel.thibault@ens-lyon.org
Samuli Karkkainen Samuli.Karkkainen@hut.fi
Expand Down
1 change: 1 addition & 0 deletions build-aux/gen-lists-of-programs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ build_if_possible_progs='
# be buildable without problems on any target system.
normal_progs='
[
b2sum
base64
base32
basename
Expand Down
3 changes: 3 additions & 0 deletions cfg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ manual_title = Core GNU utilities
# it can take a while for the faster mirror links to become usable.
url_dir_list = http://ftp.gnu.org/gnu/$(PACKAGE)

# Exclude bundled external projects from syntax checks
VC_LIST_ALWAYS_EXCLUDE_REGEX = src/blake2/.*$$

# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
sc_proper_name_utf8_requires_ICONV
Expand Down
32 changes: 31 additions & 1 deletion doc/coreutils.texi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@dircategory Individual utilities
@direntry
* arch: (coreutils)arch invocation. Print machine hardware name.
* b2sum: (coreutils)b2sum invocation. Print or check BLAKE2 digests.
* base32: (coreutils)base32 invocation. Base32 encode/decode data.
* base64: (coreutils)base64 invocation. Base64 encode/decode data.
* basename: (coreutils)basename invocation. Strip directory and suffix.
Expand Down Expand Up @@ -186,7 +187,7 @@ Free Documentation License''.
* Output of entire files:: cat tac nl od base32 base64
* Formatting file contents:: fmt pr fold
* Output of parts of files:: head tail split csplit
* Summarizing files:: wc sum cksum md5sum sha1sum sha2
* Summarizing files:: wc sum cksum b2sum md5sum sha1sum sha2
* Operating on sorted files:: sort shuf uniq comm ptx tsort
* Operating on fields:: cut paste join
* Operating on characters:: tr expand unexpand
Expand Down Expand Up @@ -259,6 +260,7 @@ Summarizing files
* wc invocation:: Print newline, word, and byte counts
* sum invocation:: Print checksum and block counts
* cksum invocation:: Print CRC checksum and byte counts
* b2sum invocation:: Print or check BLAKE2 digests
* md5sum invocation:: Print or check MD5 digests
* sha1sum invocation:: Print or check SHA-1 digests
* sha2 utilities:: Print or check SHA-2 digests
Expand Down Expand Up @@ -3557,6 +3559,7 @@ contents of files.
* wc invocation:: Print newline, word, and byte counts.
* sum invocation:: Print checksum and block counts.
* cksum invocation:: Print CRC checksum and byte counts.
* b2sum invocation:: Print or check BLAKE2 digests.
* md5sum invocation:: Print or check MD5 digests.
* sha1sum invocation:: Print or check SHA-1 digests.
* sha2 utilities:: Print or check SHA-2 digests.
Expand Down Expand Up @@ -3769,6 +3772,33 @@ options}.
@exitstatus


@node b2sum invocation
@section @command{b2sum}: Print or check BLAKE2 digests

@pindex b2sum
@cindex BLAKE2
@cindex 512-bit checksum
@cindex checksum, 512-bit
@cindex fingerprint, 512-bit
@cindex message-digest, 512-bit

@command{b2sum} computes a 512-bit checksum for each specified
@var{file}. The same usage and options as the @command{md5sum}
command are supported. @xref{md5sum invocation}.
In addition @command{b2sum} supports the following options.

@table @samp
@item -l
@itemx --length
@opindex -l
@opindex --length
@cindex BLAKE2 hash length
Change (shorten) the default digest length.
This is specified in bits and thus must be a multiple of 8.
This option is ignored when @option{--check} is specified,
as the length is automatically determined when checking.
@end table

@node md5sum invocation
@section @command{md5sum}: Print or check MD5 digests

Expand Down
1 change: 1 addition & 0 deletions man/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Makefile
Makefile.in
b2sum.1
base32.1
base64.1
basename.1
Expand Down
4 changes: 4 additions & 0 deletions man/b2sum.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[NAME]
b2sum \- compute and check BLAKE2 message digest
[DESCRIPTION]
.\" Add any additional description here
1 change: 1 addition & 0 deletions man/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ man/install.1: src/ginstall$(EXEEXT)
man/test.1: src/[$(EXEEXT)

man/arch.1: src/arch$(EXEEXT)
man/b2sum.1: src/b2sum$(EXEEXT)
man/base32.1: src/base32$(EXEEXT)
man/base64.1: src/base64$(EXEEXT)
man/basename.1: src/basename$(EXEEXT)
Expand Down
4 changes: 2 additions & 2 deletions scripts/git-hooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ $editor = "vi" if $? != 0 or $editor =~ /^\s*\z/;
# Keywords allowed before the colon on the first line of a commit message:
# program names and a few general category names.
my @valid = qw(
arch base32 base64 basename cat chcon chgrp chmod chown chroot cksum comm
cp csplit cut date dd df dir dircolors dirname du echo env expand
arch b2sum base32 base64 basename cat chcon chgrp chmod chown chroot cksum
comm cp csplit cut date dd df dir dircolors dirname du echo env expand
expr factor false fmt fold groups head hostid hostname id install
join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp
mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf
Expand Down
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.dirstamp
\[
arch
b2sum
base32
base64
basename
Expand Down
2 changes: 2 additions & 0 deletions src/blake2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.dirstamp
/.deps
Loading

0 comments on commit ea94589

Please sign in to comment.