1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-04 10:56:08 +02:00
Commit Graph

24 Commits

Author SHA1 Message Date
Jack O'Connor 4108923f52 add b3sum --seek 2023-06-06 20:25:00 -07:00
Jack O'Connor 697ca13550 suppress expected stderr prints in b3sum tests 2023-02-04 10:16:08 -08:00
Jack O'Connor 4c51c06008 add a colon to the b3sum warning format
This matches what md5sum does.
2023-02-04 10:15:25 -08:00
joveian 4c819d01bc Add --check summary of failures
Add a warning to stderr at the end similar to other *sum utilities when --check is used and some files failed verification.

At least the last part of the comment above check_one_checkfile seemed to be incorrect so I removed that comment.

Fixes #283
2023-02-04 10:14:52 -08:00
Jack O'Connor e366618d22 test `b3sum --keyed` with bad key lengths 2022-12-13 15:56:08 -08:00
Jack O'Connor 71d67e0810 make derive_key() return an array 2021-02-28 18:10:59 -05:00
Jack O'Connor e0f193ddc9 put the file name in b3sum error output
This was previously there, but got dropped in
c5c07bb337.
2020-06-24 18:02:16 -04:00
Jack O'Connor 8d6f0f2574 add a test comment 2020-05-23 14:56:43 -04:00
Jack O'Connor 48512ec4f0 use wild::args_os to support globbing on Windows 2020-05-23 12:46:45 -04:00
Jack O'Connor c9a1676942 add support for --quiet to `b3sum --check`
Suggested by @llowrey:
https://github.com/BLAKE3-team/BLAKE3/issues/33#issuecomment-629853747
2020-05-23 12:27:48 -04:00
Jack O'Connor 1d03c7d3fa print per-file errros more gracefuly in --check 2020-05-14 11:19:31 -04:00
Jack O'Connor c5c07bb337 refactor b3sum to support --check
This is an overall cleanup of everything that b3sum is doing, especially
file opening and memory mapping, which makes it easier for the regular
hashing mode to share code with the checking mode.
2020-05-13 18:23:59 -04:00
Jack O'Connor 5030c0f1c3 switch from assert_cmd to CARGO_BIN_EXE_* 2020-05-13 17:47:59 -04:00
Jack O'Connor c6a99dbb23 add parse_check_line
As part of this, reorganize b3sum tests into src/unit_tests.rs and
tests/cli_tests.rs.
2020-05-12 17:09:38 -04:00
Jack O'Connor 584a66598d stop printing the lossy warning
Rather than breaking the check parse with more output, we'll have a rule
that a Unicode replacement character (�) in a path name automatically
fails the check.
2020-05-12 09:58:54 -04:00
Jack O'Connor dc2a79d266 add newline and backslash escaping to b3sum output
As proposed in
https://github.com/BLAKE3-team/BLAKE3/issues/33#issuecomment-623153164

This brings b3sum behavior close to md5sum. All occurrences of backslash
are replaced with "\\", and all occurrences of (Unix) newline are
replaced with "\n". In addition, any line containing these escapes has a
single "\" prepended to the front.

Filepaths were already being converted to UTF-8 with to_string_lossy(),
but this commit adds an extra warning when that conversion is in fact
lossy (because the path is not valid Unicode). This new warning is
printed to stdout, with the goal of deliberately breaking --check (which
is not yet implemented) in this case.
2020-05-05 00:59:31 -04:00
Cesar Eduardo Barros 273a679ddc b3sum: add no-mmap option
Using mmap is not always the best option. For instance, if the file is
truncated while being read, b3sum will receive a SIGBUS and abort.

Follow ripgrep's lead and add a --no-mmap option to disable mmap. This
can also help benchmark the mmap versus the read path, and help debug
performance issues potentially caused by mmap access patterns (like
issue #32).
2020-01-20 11:58:07 -05:00
phayes 0e8734b7f6
Making sure our raw multi-file test is testing what we think it is 2020-01-13 14:48:24 -08:00
phayes 5cb01ad696
Using stdout_capture for capturing stdout that is not a string 2020-01-13 14:43:09 -08:00
phayes 8d251af29f
Adds support for raw output to b3sum 2020-01-13 13:12:47 -08:00
Jack O'Connor bee430b335 make the --length argument require a value 2020-01-05 19:21:47 -05:00
Jack O'Connor 2fac7447e0 make derive_key take a key of any length
The previous version of this API called for a key of exactly 256 bits.
That's good for optimal performance, but it would mean losing the
use-with-other-algorithms property for applications whose input keys are
a different size. There's no way for an abstraction over the previous
version to provide reliable domain separation for the "extract" step.
2019-12-28 17:56:29 -06:00
Jack O'Connor b1b507d43a make b3sum --keyed and --derive-key read the key from stdin
Putting secret keys on the command line is bad practice, because command
line args are usually globally visible within the OS. Even if these
flags are mostly intended for testing and experimentation, we might as
well do the right thing. Plus this saves people the trouble of hex
encoding their keys.
2019-12-13 16:10:55 -05:00
Jack O'Connor 7cf6b8f174 initial version of b3sum 2019-12-12 13:18:57 -05:00