89 Commits

Author SHA1 Message Date
Yann Collet
5a8de81527 make XXH_VECTOR values more accessible
via #include "xxhash.h"
to fix double-include issues in xsum_arch.c
2024-12-26 16:10:04 -08:00
Yann Collet
cfd77237e6 updated doc 2024-12-26 16:02:40 -08:00
Yann Collet
6bdecb5f88 fix newline minor warning 2024-12-26 02:29:15 -08:00
Yann Collet
ad392603bc fixed empty translation unit 2024-12-26 02:21:46 -08:00
Yann Collet
6c666adcdc xxhsum with auto-dispatch displays the locally detected vector extension
using command -V
ex: compiled as 64-bit x86 autoVec (AVX2 detected) little endian with GCC 13.3.0
2024-12-26 01:55:05 -08:00
Yann Collet
52a6f91461 Merge pull request #978 from Cyan4973/filelist
added --filelist command
2024-12-04 07:33:44 -08:00
Lin Runze
e7c94efe45 Add LoongArch SX SIMD extenstion implementation 2024-12-03 03:49:06 +08:00
Yann Collet
33e28c84ec added --filelist command
equivalent to recently committed --files-from .
both commands are available.
2024-11-04 22:51:18 -08:00
Ian-Clowes
40511abc81 Tidy up parameter usage
- Use --files-from instead of --generate for new feature
- Remove the need for --quiet when generating hashes from file list
2024-10-09 20:56:33 +01:00
Ian-Clowes
a923d8f253 Add --generate to man page
Describe the use and rationale for the --generate option in the man page
2024-10-09 12:25:43 +01:00
Ian-Clowes
181e065e55 Mainly fixing erroneous whitespace 2024-10-08 19:39:49 +01:00
Ian-Clowes
037e8a7257 Fix test build errors 2024-10-08 18:19:26 +01:00
Ian-Clowes
b9f37d9948 Fix CI bugs 2024-10-08 13:46:29 +01:00
Ian-Clowes
ea8728d557 Add option to generate hashes from list of files
Use --generate (-g) option to consume [files] on command line as containers of lists of files to generate hashes for
2024-10-08 12:57:11 +01:00
Yann Collet
cd6879f82a removed the console line cleaning operation (using stderr)
since it's captured by tools redirecting `stderr`.

fixes #968
2024-10-03 15:17:40 -07:00
spaette
989c5005b5 typos 2024-06-19 12:46:10 -05:00
Yann Collet
9f465f1ea9 Merge pull request #939 from Cyan4973/detect894
updated internal check in xxhsum
2024-05-07 20:20:09 -07:00
Yann Collet
8e483e4dd2 update XSUM_benchMem() doc 2024-05-07 18:21:56 -07:00
Yann Collet
02fe5d152a update version number to v0.8.3
reflecting the change for results produced by XXH3_128bits_withSecretandSeed() for the specific case of `seed == 0` and `len < 240`.
2024-05-07 18:21:56 -07:00
Yann Collet
e9f1b96702 sanity checks use XXH3_MIDSIZE_MAX from xxhash.h 2024-05-07 18:19:26 -07:00
Yann Collet
bd51be8d1e updated internal check in xxhsum
to catch bugs such as #894
2024-05-07 18:16:57 -07:00
Pavel P
b54324acee Correct check for Windows compilation
`_WIN32` is the proper check for compilation for Windows. `WIN32` is defined when `Windows.h` is included or could be defined by some projects
2024-04-01 22:06:02 +02:00
Yann Collet
59b651e386 detail selectable hash algorithms on -h page
suggested by @sergeevabc
2023-12-27 21:12:06 -08:00
Klemens Nanni
6fceee6b20 xxhsum: use pledge(2) on OpenBSD
In case no files are passed, i.e. only standard input is read,
The "rpath" promise could be dropped at a later point,
but that needs more patching.

https://man.openbsd.org/pledge.2
2023-09-14 10:49:27 +01:00
Yann Collet
ee14620ae7 added tests for xxh3sum
and updated man pages.
2023-07-25 18:57:11 +02:00
Yann Collet
d0a58163c3 added xxh3sum symlink
dedicated to producing and checking XXH3_* checksums.
2023-07-25 18:46:34 +02:00
Yann Collet
ffb4565b3a add XXH3 GNU format
using XXH3_ prefix.

Can be used both to encode and check.
2023-07-25 03:01:02 +02:00
Yann Collet
0ac3a275c3 Merge pull request #857 from t-mat/fix/ignore-missing-manpages
Add --ignore-missing and --binary to --help and xxhsum.1
2023-07-12 15:26:58 -07:00
Takayuki Matsuoka
4a473192c9 Update xxhsum.1
Generate with the following commands:

rm cli/xxhsum.1
make man
man cli/xxhsum.1
2023-07-11 01:57:03 +09:00
Takayuki Matsuoka
c45304fb66 fix style
- fix style
- add --binary
2023-07-11 01:56:32 +09:00
Takayuki Matsuoka
b6103a46de add --binary to --help message 2023-07-11 01:55:23 +09:00
Takayuki Matsuoka
e88af46329 update xxhsum.1
Generate with the following commands:

rm cli/xxhsum.1
make man
man cli/xxhsum.1
2023-07-11 01:21:25 +09:00
Takayuki Matsuoka
bfe162cae0 fix: add --ignore-missing to xxhsum.1.md 2023-07-11 01:19:59 +09:00
Takayuki Matsuoka
17dfca65fc fix: add --ignore-missing to --help message 2023-07-11 01:17:51 +09:00
Takayuki Matsuoka
e592478eea add: cli: --ignore-missing
- Add `--ignore-missing` option for `xxhsum`.
- Add test script `tests/cli-ignore-missing.sh` and related `Makefile` entries.
  - Note that we still don't have CLI test entry in our CI.

`xxhsum` returns failure exit code when

- `--ignore-missing` is presented.
- Checksum file is specified.
- But `XSUM_checkFile()` doesn't read actual file (may) due to `--ignore-missing`

If so, `xxhsum` reports `no file was verified` with failure exit code.

<details><summary>`--ignore-missing` related code in `digest.c`</summary>
- 2f1cffe07a/src/digest.c (L190-L191)
- 2f1cffe07a/src/digest.c (L362)
- 2f1cffe07a/src/digest.c (L380)
- 2f1cffe07a/src/digest.c (L506)
- 2f1cffe07a/src/digest.c (L978-L982)
- 2f1cffe07a/src/digest.c (L1236-L1240)
- 2f1cffe07a/src/digest.c (L1325-L1328)
- 2f1cffe07a/src/digest.c (L1429-L1431)
- 2f1cffe07a/src/digest.c (L1558-L1564)
</details>
2023-07-10 17:43:40 +09:00
Yann Collet
c234b940f0 Merge pull request #825 from easyaspi314/wasm128
Add WebAssembly SIMD128 implementation and Node.JS support
2023-07-09 22:21:00 -07:00
Takayuki Matsuoka
d7dce1893b feature: CLI: --binary
Add `--binary` to xxhsum.  It's just ignored.
Note that we don't have `--text`.
See also https://github.com/Cyan4973/xxHash/issues/812
2023-07-09 22:36:02 +09:00
Yann Collet
0da2381a84 Detect and display SVE when active
display was mistakenly mentioning NEON instead.

Codemod inspired by @hzhuang1 's #762.
2023-07-03 01:46:33 +02:00
Yann Collet
dfd7617268 update version number to v0.8.2 2023-06-30 03:16:09 +02:00
Takayuki Matsuoka
4823f56e1f Fix for compiler warnings
Add "case GetLine_comment:" to conform -Werror=switch-enum.

```
cli/xxhsum.c: In function ‘XSUM_parseFile1’:
cli/xxhsum.c:814:17: error: enumeration value ‘GetLine_comment’ not handled in switch [-Werror=switch-enum]
  814 |                 switch (XSUM_getLineResult)
      |                 ^~~~~~
```
2023-06-17 20:48:12 +09:00
Takayuki Matsuoka
2f405e46bb feature: support # comment lines in --check files
This change fixes issue #836.

Basically, we just follow the following logic in the digest.c of GNU coreutils.
d53190ed46/src/digest.c (L1180-L1182)

Note that we only allow '#' at the beginning of the line.
2023-06-17 20:34:32 +09:00
easyaspi314
125f89fb51 Add node.js wasm/asm.js tests for Github CI
Currently only one version of EMCC, testing node 16, 17, and 18.

Cache is used because the emsdk has to cache each library which takes
a bit.
2023-03-15 01:36:23 -04:00
easyaspi314
207e2abcc9 Add some nodejs workarounds so make check works
- Link in `nodefs` and `noderawfs`
 - Use Node's `tty.isatty()` via inline JS instead of the broken libc `isatty()`
 - Used with `make NODE_JS=1`
2023-03-15 01:35:43 -04:00
Yann Collet
c9df1e26d3 Merge pull request #820 from Cyan4973/test816
added one test length for xxh sanity checks
2023-03-11 13:26:54 -08:00
Yann Collet
bea35c64f0 benchmark : adjust initial speed target to 10 MB/s
Additionally, the initial speed target can be selected at compilation time,
by setting new optional build macro XXH_1ST_SPEED_TARGET.

Solves @easyaspi314 comment in https://github.com/Cyan4973/xxHash/issues/821#issuecomment-1462961579,
in order to support "1.5 GHz Cortex-A53 tablet with s390x in QEMU with -O0 -mzvector"
which is very slow.
2023-03-09 17:13:22 -08:00
Yann Collet
7dd426a541 added one test length for xxh sanity checks
to detect off-by-one scrambling error like #816
2023-03-09 09:27:40 -08:00
Yannic Staudt
e445e5bc09 🔧 fixing https://github.com/Cyan4973/xxHash/pull/759 2022-11-10 17:17:18 +01:00
Haojian Zhuang
dde858b9a2 fix issues reported by cppcheck
Run command "make clean cppcheck".

---- static analyzer - cppcheck ----
cppcheck . --force --enable=warning,portability,performance,style --error-exitcode=1 > /dev/null
cli/xsum_os_specific.c:220:9: style: The scope of the variable 'ret' can be reduced. [variableScope]
    int ret;
        ^
cli/xsum_sanity_check.c:571:19: style: Condition 'len>0' is always true [knownConditionTrueFalse]
    } else if (len>0) {
                  ^
cli/xsum_sanity_check.c:569:13: note: Assuming that condition 'len==0' is not redundant
    if (len == 0) {
            ^
cli/xsum_sanity_check.c:571:19: note: Condition 'len>0' is always true
    } else if (len>0) {
                  ^
tests/bench/benchHash.c:112:55: error: Uninitialized variables: result.internal_never_ever_use_directly, result.error_result_never_ever_use_directly, result.error_tag_never_ever_use_directly [uninitvar]
    BMK_runTime_t const runTime = BMK_extract_runTime(result);
                                                      ^
tests/bench/benchHash.c:107:12: note: Assuming condition is false
    while (!BMK_isCompleted_TimedFn(txf)) {
           ^
tests/bench/benchHash.c:107:12: note: Assuming condition is false
    while (!BMK_isCompleted_TimedFn(txf)) {
           ^
tests/bench/benchHash.c:107:12: note: Assuming condition is false
    while (!BMK_isCompleted_TimedFn(txf)) {
           ^
tests/bench/benchHash.c:112:55: note: Uninitialized variables: result.internal_never_ever_use_directly, result.error_result_never_ever_use_directly, result.error_tag_never_ever_use_directly
    BMK_runTime_t const runTime = BMK_extract_runTime(result);
                                                      ^
tests/bench/benchfn.c:95:12: error: Uninitialized variable: outcome.error_result_never_ever_use_directly [uninitvar]
    return outcome;
           ^
tests/collisions/main.c:209:14: style: Same expression on both sides of '<='. [duplicateExpression]
    assert(m <= m);
             ^
make: *** [Makefile:387: cppcheck] Error 1

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2022-10-19 13:10:12 +08:00
Dimitri Papadopoulos
82b600a846 Fix typos found by codespell 2022-09-08 23:01:03 +02:00
Takayuki Matsuoka
02dc2abfe3 Introduce new enum AlgoBitmask to fix #724.
main() introduces new variable algoBitmask which represents the algorithm(s)
which will be accepted by the CLI.
main() also sets suitable algoBitmask for exename and passes it to
XSUM_checkFiles().
The default algoBitmask is algo_bitmask_all which accepts all xxh algorithms.

XSUM_checkFiles() passes algoBitmask to XSUM_checkFile().

XSUM_checkFile() sets algoBitmask to XSUM_parseFileArg->algoBitmask and
invokes XSUM_parseFile1().

XSUM_parseFile1() passes algoBitmask to XSUM_parseLine().

XSUM_parseLine() passes algoBitmask to XSUM_parseLine1().

XSUM_parseLine1() calles XSUM_algoBitmask_Accepts() to check
actual xxh algorithm of the line and algoBitmask matches or not.
2022-07-30 04:51:39 +09:00