Commit 10f466bb authored by Nikita Malyavin's avatar Nikita Malyavin

add xxh

parent 95d327aa
......@@ -162,8 +162,12 @@ IF(HAVE_MLOCK)
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_lockmem.c)
ENDIF()
set(XXHASH_BUILD_ENABLE_INLINE_API ON)
ADD_SUBDIRECTORY(../xxhash/cmake_unofficial ../xxhash/build)
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
MAYBE_DISABLE_IPO(mysys)
TARGET_LINK_LIBRARIES(mysys xxHash::xxhash)
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO})
DTRACE_INSTRUMENT(mysys)
......
......@@ -22,6 +22,7 @@
#include <m_string.h>
#include <m_ctype.h>
#include "hash.h"
#include "xxhash.h"
#define NO_RECORD ~((my_hash_value_type) 0)
#define LOWFIND 1
......@@ -45,8 +46,12 @@ my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
size_t length)
{
ulong nr1= 1, nr2= 4;
my_ci_hash_sort(cs, (uchar*) key, length, &nr1, &nr2);
return (my_hash_value_type) nr1;
if (cs != &my_charset_bin)
{
my_ci_hash_sort(cs, (uchar*) key, length, &nr1, &nr2);
return (my_hash_value_type) nr1;
}
return (my_hash_value_type) XXH3_64bits(key, length);
}
/**
......
......@@ -325,8 +325,8 @@ static inline my_hash_value_type calc_hash(CHARSET_INFO *cs,
size_t keylen)
{
ulong nr1= 1, nr2= 4;
my_ci_hash_sort(cs, (uchar*) key, keylen, &nr1, &nr2);
return nr1;
// my_ci_hash_sort(cs, (uchar*) key, keylen, &nr1, &nr2);
return my_hash_sort(cs, key, keylen);
}
#define MAX_LOAD 1.0 /* average number of elements in a bucket */
......
language: c
# Dump CPU info before start
before_install:
- cat /proc/cpuinfo || echo /proc/cpuinfo is not present
matrix:
fast_finish: true
include:
- name: General linux x64 tests
arch: amd64
addons:
apt:
packages:
- g++-multilib
- gcc-multilib
- cppcheck
script:
- make -B test-all
- make clean
- CFLAGS="-Werror" MOREFLAGS="-Wno-sign-conversion" make dispatch # removing sign conversion warnings due to a bug in gcc-5's definition of some AVX512 intrinsics
- make clean
- CFLAGS="-O1 -mavx512f -Werror" make
- make clean
- CFLAGS="-Wall -Wextra -Werror" make DISPATCH=1
- make clean
- CFLAGS="-std=c90 -pedantic -Wno-long-long -Werror" make xxhsum # check C90 + long long compliance
- make c90test # strict c90, with no long long support; resulting in no XXH64_* symbol
- make noxxh3test # check library can be compiled with XXH_NO_XXH3, resulting in no XXH3_* symbol
- name: Check results consistency on x64
arch: amd64
script:
- CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR make check # Scalar code path
- make clean
- CPPFLAGS=-DXXH_VECTOR=XXH_SSE2 make check # SSE2 code path
- make clean
- CPPFLAGS="-mavx2 -DXXH_VECTOR=XXH_AVX2" make check # AVX2 code path
- make clean
- CPPFLAGS="-mavx512f -DXXH_VECTOR=XXH_AVX512" make check # AVX512 code path
- make clean
- CPPFLAGS=-DXXH_REROLL=1 make check # reroll code path (#240)
- make -C tests/bench
- name: macOS General Test
os: osx
compiler: clang
script:
- CFLAGS="-Werror" make # test library build
- make clean
- make test MOREFLAGS='-Werror' | tee # test scenario where `stdout` is not the console
- name: ARM compilation and consistency checks (Qemu)
dist: xenial
arch: amd64
addons:
apt:
packages:
- qemu-system-arm
- qemu-user-static
- gcc-arm-linux-gnueabi
- libc6-dev-armel-cross
script:
# arm (32-bit)
- CC=arm-linux-gnueabi-gcc CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR LDFLAGS=-static RUN_ENV=qemu-arm-static make check # Scalar code path
- make clean
# NEON (32-bit)
- CC=arm-linux-gnueabi-gcc CPPFLAGS=-DXXH_VECTOR=XXH_NEON CFLAGS="-O3 -march=armv7-a -fPIC -mfloat-abi=softfp -mfpu=neon-vfpv4" LDFLAGS=-static RUN_ENV=qemu-arm-static make check # NEON code path
- name: aarch64 compilation and consistency checks
dist: xenial
arch: arm64
script:
# aarch64
- CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR make check # Scalar code path
# NEON (64-bit)
- make clean
- CPPFLAGS=-DXXH_VECTOR=XXH_NEON make check # NEON code path
# clang
- make clean
- CC=clang CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR make check # Scalar code path
# clang + NEON
- make clean
- CC=clang CPPFLAGS=-DXXH_VECTOR=XXH_NEON make check # NEON code path
# We need Bionic here because the QEMU versions shipped in the older repos
# do not support POWER8 emulation, and compiling QEMU from source is a pain.
- name: PowerPC + PPC64 compilation and consistency checks (Qemu on Bionic)
dist: bionic
arch: amd64
addons:
apt:
packages:
- qemu-system-ppc
- qemu-user-static
- gcc-powerpc-linux-gnu
- gcc-powerpc64-linux-gnu
- libc6-dev-powerpc-cross
- libc6-dev-ppc64-cross
script:
- CC=powerpc-linux-gnu-gcc RUN_ENV=qemu-ppc-static LDFLAGS=-static make check # Scalar code path
- make clean
- CC=powerpc64-linux-gnu-gcc RUN_ENV=qemu-ppc64-static CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR CFLAGS="-O3" LDFLAGS="-static -m64" make check # Scalar code path
# VSX code
- make clean
- CC=powerpc64-linux-gnu-gcc RUN_ENV="qemu-ppc64-static -cpu power8" CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-O3 -maltivec -mvsx -mcpu=power8 -mpower8-vector" LDFLAGS="-static -m64" make check # VSX code path
# altivec.h redefinition issue #426
- make clean
- CC=powerpc64-linux-gnu-gcc CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-maltivec -mvsx -mcpu=power8 -mpower8-vector" make -C tests test_ppc_redefine
- name: PPC64LE compilation and consistency checks
dist: xenial
arch: ppc64le
script:
# Scalar (universal) code path
- CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR LDFLAGS=-static make check
# VSX code path (64-bit)
- make clean
- CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-O3 -maltivec -mvsx -mpower8-vector -mcpu=power8" LDFLAGS="-static" make check
# altivec.h redefinition issue #426
- make clean
- CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-maltivec -mvsx -mcpu=power8 -mpower8-vector" make -C tests test_ppc_redefine
- name: IBM s390x compilation and consistency checks
dist: bionic
arch: s390x
script:
# Scalar (universal) code path
- CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR LDFLAGS=-static make check
# s390x code path (64-bit)
- make clean
- CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-O3 -march=arch11 -mzvector" LDFLAGS="-static" make check
- name: cmake build test
script:
- cd cmake_unofficial
- mkdir build
- cd build
- cmake ..
- CFLAGS=-Werror make
v0.8.1
- perf : much improved performance for XXH3 streaming variants, notably on gcc and msvc
- perf : improved XXH64 speed and latency on small inputs
- perf : small XXH32 speed and latency improvement on small inputs of random size
- perf : minor stack usage improvement for XXH32 and XXH64
- api : new experimental variants XXH3_*_withSecretandSeed()
- api : update XXH3_generateSecret(), can no generate secret of any size (>= XXH3_SECRET_SIZE_MIN)
- cli : xxhsum can now generate and check XXH3 checksums, using command `-H3`
- build: can build xxhash without XXH3, with new build macro XXH_NO_XXH3
- build: fix xxh_x86dispatch build with MSVC, by @apankrat
- build: XXH_INLINE_ALL can always be used safely, even after XXH_NAMESPACE or a previous XXH_INLINE_ALL
- build: improved PPC64LE vector support, by @mpe
- install: fix pkgconfig, by @ellert
- install: compatibility with Haiku, by @Begasus
- doc : code comments made compatible with doxygen, by @easyaspi314
- misc : XXH_ACCEPT_NULL_INPUT_POINTER is no longer necessary, all functions can accept NULL input pointers, as long as size == 0
- misc : complete refactor of CI tests on Github Actions, offering much larger coverage, by @t-mat
- misc : xxhsum code base split into multiple specialized units, within directory cli/, by @easyaspi314
v0.8.0
- api : stabilize XXH3
- cli : xxhsum can parse BSD-style --check lines, by @WayneD
- cli : `xxhsum -` accepts console input, requested by @jaki
- cli : xxhsum accepts -- separator, by @jaki
- cli : fix : print correct default algo for symlinked helpers, by @martinetd
- install: improved pkgconfig script, allowing custom install locations, requested by @ellert
v0.7.4
- perf: automatic vector detection and selection at runtime (`xxh_x86dispatch.h`), initiated by @easyaspi314
- perf: added AVX512 support, by @gzm55
- api : new: secret generator `XXH_generateSecret()`, suggested by @koraa
- api : fix: XXH3_state_t is movable, identified by @koraa
- api : fix: state is correctly aligned in AVX mode (unlike `malloc()`), by @easyaspi314
- api : fix: streaming generated wrong values in some combination of random ingestion lengths, reported by @WayneD
- cli : fix unicode print on Windows, by @easyaspi314
- cli : can `-c` check file generated by sfv
- build: `make DISPATCH=1` generates `xxhsum` and `libxxhash` with runtime vector detection (x86/x64 only)
- install: cygwin installation support
- doc : Cryptol specification of XXH32 and XXH64, by @weaversa
v0.7.3
- perf: improved speed for large inputs (~+20%)
- perf: improved latency for small inputs (~10%)
- perf: s390x Vectorial code, by @easyaspi314
- cli: improved support for Unicode filenames on Windows, thanks to @easyaspi314 and @t-mat
- api: `xxhash.h` can now be included in any order, with and without `XXH_STATIC_LINKING_ONLY` and `XXH_INLINE_ALL`
- build: xxHash's implementation transferred into `xxhash.h`. No more need to have `xxhash.c` in the `/include` directory for `XXH_INLINE_ALL` to work
- install: created pkg-config file, by @bket
- install: VCpkg installation instructions, by @LilyWangL
- doc: Highly improved code documentation, by @easyaspi314
- misc: New test tool in `/tests/collisions`: brute force collision tester for 64-bit hashes
v0.7.2
- Fixed collision ratio of `XXH128` for some specific input lengths, reported by @svpv
- Improved `VSX` and `NEON` variants, by @easyaspi314
- Improved performance of scalar code path (`XXH_VECTOR=0`), by @easyaspi314
- `xxhsum`: can generate 128-bit hashes with the `-H2` option (note: for experimental purposes only! `XXH128` is not yet frozen)
- `xxhsum`: option `-q` removes status notifications
v0.7.1
- Secret first: the algorithm computation can be altered by providing a "secret", which is any blob of bytes, of size >= `XXH3_SECRET_SIZE_MIN`.
- `seed` is still available, and acts as a secret generator
- updated `ARM NEON` variant by @easyaspi314
- Streaming implementation is available
- Improve compatibility and performance with Visual Studio, with help from @aras-p
- Better integration when using `XXH_INLINE_ALL`: do not pollute host namespace, use its own macros, such as `XXH_ASSERT()`, `XXH_ALIGN`, etc.
- 128-bit variant provides helper functions for comparison of hashes.
- Better `clang` generation of `rotl` instruction, thanks to @easyaspi314
- `XXH_REROLL` build macro to reduce binary size, by @easyaspi314
- Improved `cmake` script, by @Mezozoysky
- Full benchmark program provided in `/tests/bench`
# Doxygen config for xxHash
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "xxHash"
PROJECT_NUMBER = "0.8.1"
PROJECT_BRIEF = "Extremely fast non-cryptographic hash function"
OUTPUT_DIRECTORY = doxygen
OUTPUT_LANGUAGE = English
# We already separate the internal docs.
INTERNAL_DOCS = YES
# Consistency
SORT_MEMBER_DOCS = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
# Warnings
QUIET = YES
# Until we document everything
WARN_IF_UNDOCUMENTED = NO
# TODO: Add the other files. It is just xxhash.h for now.
FILE_PATTERNS = xxhash.h xxh_x86dispatch.c
# Note: xxHash's source files are technically ASCII only.
INPUT_ENCODING = UTF-8
TAB_SIZE = 4
MARKDOWN_SUPPORT = YES
# xxHash is a C library
OPTIMIZE_OUTPUT_FOR_C = YES
# So we can document the internals
EXTRACT_STATIC = YES
# Document the macros
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
# Predefine some macros to clean up the output.
PREDEFINED = "XXH_DOXYGEN=" \
"XXH_PUBLIC_API=" \
"XXH_FORCE_INLINE=static inline" \
"XXH_NO_INLINE=static" \
"XXH_RESTRICT=restrict" \
"XSUM_API=" \
"XXH_STATIC_LINKING_ONLY" \
"XXH_IMPLEMENTATION" \
"XXH_PUREF=[[gnu::pure]]" \
"XXH_CONSTF=[[gnu::const]]" \
"XXH_MALLOCF=[[gnu::malloc]]" \
"XXH_ALIGN(N)=alignas(N)" \
"XXH_ALIGN_MEMBER(align,type)=alignas(align) type"
# We want HTML docs
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
# Tweak the colors a bit
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_GAMMA = 100
HTML_COLORSTYLE_SAT = 100
# We don't want LaTeX.
GENERATE_LATEX = NO
xxHash Library
Copyright (c) 2012-2021 Yann Collet
All rights reserved.
BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This diff is collapsed.
# Security Policy
## Supported Versions
Security updates are applied only to the latest release.
## Reporting a Vulnerability
If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
Please disclose it at [security advisory](https://github.com/Cyan4973/xxHash/security/advisories/new).
This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.
#---------------------------------#
# general configuration #
#---------------------------------#
version: 1.0.{build}
max_jobs: 2
#---------------------------------#
# environment configuration #
#---------------------------------#
clone_depth: 2
environment:
matrix:
- COMPILER: "visual"
ARCH: "x64"
TEST_XXHSUM: "true"
- COMPILER: "visual"
ARCH: "Win32"
TEST_XXHSUM: "true"
- COMPILER: "visual"
ARCH: "Win32"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TEST_XXHSUM: "true"
- COMPILER: "visual"
ARCH: "ARM"
# Below tests are now disabled due to redundancy.
# Their equivalent already runs correctly on Github Actions.
# - COMPILER: "visual"
# ARCH: "x64"
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# TEST_XXHSUM: "true"
# - COMPILER: "visual"
# ARCH: "ARM64"
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# # note: ARM64 is not available with Visual Studio 14 2015, which is default for Appveyor
# The following tests were also flacky on Appveyor, for various reasons.
# - COMPILER: "gcc"
# PLATFORM: "mingw64"
# - COMPILER: "gcc"
# PLATFORM: "mingw32"
# - COMPILER: "gcc"
# PLATFORM: "clang"
install:
- ECHO Installing %COMPILER% %PLATFORM% %ARCH%
- MKDIR bin
- if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH%
- if [%COMPILER%]==[gcc] (
SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" &&
SET "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin" &&
COPY C:\MinGW\bin\mingw32-make.exe C:\MinGW\bin\make.exe &&
COPY C:\MinGW\bin\gcc.exe C:\MinGW\bin\cc.exe
)
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- if [%PLATFORM%]==[mingw32] SET PATH=%PATH_MINGW32%;%PATH_ORIGINAL%
- if [%PLATFORM%]==[mingw64] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL%
- if [%PLATFORM%]==[clang] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL%
- ECHO ***
- ECHO Building %COMPILER% %PLATFORM% %ARCH%
- ECHO ***
- if [%COMPILER%]==[gcc] (
if [%PLATFORM%]==[clang] (
clang -v
) ELSE (
gcc -v
)
)
- if [%COMPILER%]==[gcc] (
echo ----- &&
make -v &&
echo ----- &&
if not [%PLATFORM%]==[clang] (
if [%PLATFORM%]==[mingw32] ( SET CPPFLAGS=-DPOOL_MT=0 ) &&
make -B clean test MOREFLAGS=-Werror
) ELSE (
SET CXXFLAGS=--std=c++14 &&
make -B clean test CC=clang CXX=clang++ MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wno-pass-failed" NO_C90_TEST=true
) &&
make -C tests/bench
)
# note 1: strict c90 tests with clang fail, due to (erroneous) presence on `inline` keyword in some included system file
# note 2: multi-threading code doesn't work with mingw32, disabled through POOL_MT=0
# note 3: clang requires C++14 to compile sort because its own code contains c++14-only code
- if [%COMPILER%]==[visual] (
cd cmake_unofficial &&
cmake . -DCMAKE_BUILD_TYPE=Release -A %ARCH% -DXXHASH_C_FLAGS="/WX" &&
cmake --build . --config Release
)
#---------------------------------#
# tests configuration #
#---------------------------------#
test_script:
# note: can only run x86 and x64 binaries on Appveyor
# note: if %COMPILER%==gcc, xxhsum was already tested within `make test`
- if [%TEST_XXHSUM%]==[true] (
ECHO *** &&
ECHO Testing %COMPILER% %PLATFORM% %ARCH% &&
ECHO *** &&
cd Release &&
xxhsum.exe -bi1 &&
ECHO ------- xxhsum tested -------
)
#---------------------------------#
# artifacts configuration #
#---------------------------------#
# none yet
{
"Cyan4973/xxHash": { }
}
\ No newline at end of file
This diff is collapsed.
This directory contains source code dedicated to the `xxhsum` command line utility,
which is a user program of `libxxhash`.
Note that, in contrast with the library `libxxhash`, the command line utility `xxhsum` ships with GPLv2 license.
/*
* xxhsum - Command line interface for xxhash algorithms
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
/*
* Checks for predefined macros by the compiler to try and get both the arch
* and the compiler version.
*/
#ifndef XSUM_ARCH_H
#define XSUM_ARCH_H
#include "xsum_config.h"
#define XSUM_LIB_VERSION XXH_VERSION_MAJOR.XXH_VERSION_MINOR.XXH_VERSION_RELEASE
#define XSUM_QUOTE(str) #str
#define XSUM_EXPAND_AND_QUOTE(str) XSUM_QUOTE(str)
#define XSUM_PROGRAM_VERSION XSUM_EXPAND_AND_QUOTE(XSUM_LIB_VERSION)
/* Show compiler versions in WELCOME_MESSAGE. XSUM_CC_VERSION_FMT will return the printf specifiers,
* and VERSION will contain the comma separated list of arguments to the XSUM_CC_VERSION_FMT string. */
#if defined(__clang_version__)
/* Clang does its own thing. */
# ifdef __apple_build_version__
# define XSUM_CC_VERSION_FMT "Apple Clang %s"
# else
# define XSUM_CC_VERSION_FMT "Clang %s"
# endif
# define XSUM_CC_VERSION __clang_version__
#elif defined(__VERSION__)
/* GCC and ICC */
# define XSUM_CC_VERSION_FMT "%s"
# ifdef __INTEL_COMPILER /* icc adds its prefix */
# define XSUM_CC_VERSION __VERSION__
# else /* assume GCC */
# define XSUM_CC_VERSION "GCC " __VERSION__
# endif
#elif defined(_MSC_FULL_VER) && defined(_MSC_BUILD)
/*
* MSVC
* "For example, if the version number of the Visual C++ compiler is
* 15.00.20706.01, the _MSC_FULL_VER macro evaluates to 150020706."
*
* https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2017
*/
# define XSUM_CC_VERSION_FMT "MSVC %02i.%02i.%05i.%02i"
# define XSUM_CC_VERSION _MSC_FULL_VER / 10000000 % 100, _MSC_FULL_VER / 100000 % 100, _MSC_FULL_VER % 100000, _MSC_BUILD
#elif defined(_MSC_VER) /* old MSVC */
# define XSUM_CC_VERSION_FMT "MSVC %02i.%02i"
# define XSUM_CC_VERSION _MSC_VER / 100, _MSC_VER % 100
#elif defined(__TINYC__)
/* tcc stores its version in the __TINYC__ macro. */
# define XSUM_CC_VERSION_FMT "tcc %i.%i.%i"
# define XSUM_CC_VERSION __TINYC__ / 10000 % 100, __TINYC__ / 100 % 100, __TINYC__ % 100
#else
# define XSUM_CC_VERSION_FMT "%s"
# define XSUM_CC_VERSION "unknown compiler"
#endif
/* makes the next part easier */
#if (defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)) && !defined(_M_ARM64EC)
# define XSUM_ARCH_X64 1
# define XSUM_ARCH_X86 "x86_64"
#elif defined(__i386__) || defined(_M_IX86) || defined(_M_IX86_FP)
# define XSUM_ARCH_X86 "i386"
#endif
/* Try to detect the architecture. */
#if defined(XSUM_ARCH_X86)
# if defined(XXHSUM_DISPATCH)
# define XSUM_ARCH XSUM_ARCH_X86 " autoVec"
# elif defined(__AVX512F__)
# define XSUM_ARCH XSUM_ARCH_X86 " + AVX512"
# elif defined(__AVX2__)
# define XSUM_ARCH XSUM_ARCH_X86 " + AVX2"
# elif defined(__AVX__)
# define XSUM_ARCH XSUM_ARCH_X86 " + AVX"
# elif defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) \
|| defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP == 2)
# define XSUM_ARCH XSUM_ARCH_X86 " + SSE2"
# else
# define XSUM_ARCH XSUM_ARCH_X86
# endif
#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
# define XSUM_ARCH "aarch64 + NEON"
#elif defined(__arm__) || defined(__thumb__) || defined(__thumb2__) || defined(_M_ARM)
/* ARM has a lot of different features that can change xxHash significantly. */
# ifdef __ARM_ARCH
# define XSUM_ARCH_ARM_VER XSUM_EXPAND_AND_QUOTE(__ARM_ARCH)
# else
# define XSUM_ARCH_ARM_VER XSUM_EXPAND_AND_QUOTE(_M_ARM)
# endif
# if defined(_M_ARM) /* windows arm is always thumb-2 */ \
|| defined(__thumb2__) || (defined(__thumb__) && (__thumb__ == 2 || __ARM_ARCH >= 7))
# define XSUM_ARCH_THUMB " Thumb-2"
# elif defined(__thumb__)
# define XSUM_ARCH_THUMB " Thumb-1"
# else
# define XSUM_ARCH_THUMB ""
# endif
/* ARMv7 has unaligned by default */
# if defined(__ARM_FEATURE_UNALIGNED) || __ARM_ARCH >= 7 || defined(_M_ARM)
# define XSUM_ARCH_UNALIGNED " + unaligned"
# else
# define XSUM_ARCH_UNALIGNED ""
# endif
# if defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(_M_ARM)
# define XSUM_ARCH_NEON " + NEON"
# else
# define XSUM_ARCH_NEON ""
# endif
# define XSUM_ARCH "ARMv" XSUM_ARCH_ARM_VER XSUM_ARCH_THUMB XSUM_ARCH_NEON XSUM_ARCH_UNALIGNED
#elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__)
# if defined(__GNUC__) && defined(__POWER9_VECTOR__)
# define XSUM_ARCH "ppc64 + POWER9 vector"
# elif defined(__GNUC__) && defined(__POWER8_VECTOR__)
# define XSUM_ARCH "ppc64 + POWER8 vector"
# else
# define XSUM_ARCH "ppc64"
# endif
#elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__)
# define XSUM_ARCH "ppc"
#elif defined(__AVR)
# define XSUM_ARCH "AVR"
#elif defined(__mips64)
# define XSUM_ARCH "mips64"
#elif defined(__mips)
# define XSUM_ARCH "mips"
#elif defined(__s390x__)
# define XSUM_ARCH "s390x"
#elif defined(__s390__)
# define XSUM_ARCH "s390"
#else
# define XSUM_ARCH "unknown"
#endif
#endif /* XSUM_ARCH_H */
This diff is collapsed.
/*
* xsum_bench - Benchmark functions for xxhsum
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
#ifndef XSUM_BENCH_H
#define XSUM_BENCH_H
#include <stddef.h> /* size_t */
#define NBLOOPS_DEFAULT 3 /* Default number of benchmark iterations */
extern int const g_nbTestFunctions;
extern char g_testIDs[]; /* size : g_nbTestFunctions */
extern const char k_testIDs_default[];
extern int g_nbIterations;
int XSUM_benchInternal(size_t keySize);
int XSUM_benchFiles(const char* fileNamesTable[], int nbFiles);
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* XSUM_BENCH_H */
/*
* xxhsum - Command line interface for xxhash algorithms
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
/*
* This contains various configuration parameters and feature detection for
* xxhsum.
*
* Similar to config.h in Autotools, this should be the first header included.
*/
#ifndef XSUM_CONFIG_H
#define XSUM_CONFIG_H
/* ************************************
* Compiler Options
**************************************/
/*
* Disable Visual C's warnings when using the "insecure" CRT functions instead
* of the "secure" _s functions.
*
* These functions are not portable, and aren't necessary if you are using the
* original functions properly.
*/
#if defined(_MSC_VER) || defined(_WIN32)
# ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
# endif
#endif
/* Under Linux at least, pull in the *64 commands */
#ifndef _LARGEFILE64_SOURCE
# define _LARGEFILE64_SOURCE
#endif
#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
#endif
/*
* So we can use __attribute__((__format__))
*/
#ifdef __GNUC__
# define XSUM_ATTRIBUTE(x) __attribute__(x)
#else
# define XSUM_ATTRIBUTE(x)
#endif
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) /* UNIX-like OS */ \
|| defined(__midipix__) || defined(__VMS))
# if (defined(__APPLE__) && defined(__MACH__)) || defined(__SVR4) || defined(_AIX) || defined(__hpux) /* POSIX.1-2001 (SUSv3) conformant */ \
|| defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) /* BSD distros */
# define XSUM_PLATFORM_POSIX_VERSION 200112L
# else
# if defined(__linux__) || defined(__linux)
# ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L /* use feature test macro */
# endif
# endif
# include <unistd.h> /* declares _POSIX_VERSION */
# if defined(_POSIX_VERSION) /* POSIX compliant */
# define XSUM_PLATFORM_POSIX_VERSION _POSIX_VERSION
# else
# define XSUM_PLATFORM_POSIX_VERSION 0
# endif
# endif
#endif
#if !defined(XSUM_PLATFORM_POSIX_VERSION)
# define XSUM_PLATFORM_POSIX_VERSION -1
#endif
#if !defined(S_ISREG)
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
#endif
/* ************************************
* Windows helpers
**************************************/
/*
* Whether to use the Windows UTF-16 APIs instead of the portable libc 8-bit
* ("ANSI") APIs.
*
* Windows is not UTF-8 clean by default, and the only way to access every file
* on the OS is to use UTF-16.
*
* Do note that xxhsum uses UTF-8 internally and only uses UTF-16 for command
* line arguments, console I/O, and opening files.
*
* Additionally, this guarantees all piped output is UTF-8.
*/
#if defined(XSUM_WIN32_USE_WCHAR) && !defined(_WIN32)
/* We use Windows APIs, only use this on Windows. */
# undef XSUM_WIN32_USE_WCHAR
#endif
#ifndef XSUM_WIN32_USE_WCHAR
# if defined(_WIN32)
# include <wchar.h>
# if WCHAR_MAX == 0xFFFFU /* UTF-16 wchar_t */
# define XSUM_WIN32_USE_WCHAR 1
# else
# define XSUM_WIN32_USE_WCHAR 0
# endif
# else
# define XSUM_WIN32_USE_WCHAR 0
# endif
#endif
#if !XSUM_WIN32_USE_WCHAR
/*
* It doesn't make sense to have one without the other.
* Due to XSUM_WIN32_USE_WCHAR being undef'd, this also handles
* non-WIN32 platforms.
*/
# undef XSUM_WIN32_USE_WMAIN
# define XSUM_WIN32_USE_WMAIN 0
#else
/*
* Whether to use wmain() or main().
*
* wmain() is preferred because we don't have to mess with internal hidden
* APIs.
*
* It always works on MSVC, but in MinGW, it only works on MinGW-w64 with the
* -municode flag.
*
* Therefore we have to use main() -- there is no better option.
*/
# ifndef XSUM_WIN32_USE_WMAIN
# if defined(_UNICODE) || defined(UNICODE) /* MinGW -municode */ \
|| defined(_MSC_VER) /* MSVC */
# define XSUM_WIN32_USE_WMAIN 1
# else
# define XSUM_WIN32_USE_WMAIN 0
# endif
# endif
/*
* It is always good practice to define these to prevent accidental use of the
* ANSI APIs, even if the program primarily uses UTF-8.
*/
# ifndef _UNICODE
# define _UNICODE
# endif
# ifndef UNICODE
# define UNICODE
# endif
#endif /* XSUM_WIN32_USE_WCHAR */
#ifndef XSUM_API
# ifdef XXH_INLINE_ALL
# define XSUM_API static
# else
# define XSUM_API
# endif
#endif
#ifndef XSUM_NO_TESTS
# define XSUM_NO_TESTS 0
#endif
/* ***************************
* Basic types
* ***************************/
#if defined(__cplusplus) /* C++ */ \
|| (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) /* C99 */
# include <stdint.h>
typedef uint8_t XSUM_U8;
typedef uint32_t XSUM_U32;
typedef uint64_t XSUM_U64;
# else
# include <limits.h>
typedef unsigned char XSUM_U8;
# if UINT_MAX == 0xFFFFFFFFUL
typedef unsigned int XSUM_U32;
# else
typedef unsigned long XSUM_U32;
# endif
typedef unsigned long long XSUM_U64;
#endif /* not C++/C99 */
/* ***************************
* Common constants
* ***************************/
#define KB *( 1<<10)
#define MB *( 1<<20)
#define GB *(1U<<30)
#endif /* XSUM_CONFIG_H */
This diff is collapsed.
/*
* xxhsum - Command line interface for xxhash algorithms
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
#ifndef XSUM_OS_SPECIFIC_H
#define XSUM_OS_SPECIFIC_H
#include "xsum_config.h"
#include <stdio.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Declared here to be implemented in user code.
*
* Functions like main(), but is passed UTF-8 arguments even on Windows.
*/
XSUM_API int XSUM_main(int argc, const char* argv[]);
/*
* Returns whether stream is a console.
*
* Functionally equivalent to isatty(fileno(stream)).
*/
XSUM_API int XSUM_isConsole(FILE* stream);
/*
* Sets stream to pure binary mode (a.k.a. no CRLF conversions).
*/
XSUM_API void XSUM_setBinaryMode(FILE* stream);
/*
* Returns whether the file at filename is a directory.
*/
XSUM_API int XSUM_isDirectory(const char* filename);
/*
* Returns the file size of the file at filename.
*/
XSUM_API XSUM_U64 XSUM_getFileSize(const char* filename);
/*
* UTF-8 stdio wrappers primarily for Windows
*/
/*
* fopen() wrapper. Accepts UTF-8 filenames on Windows.
*
* Specifically, on Windows, the arguments will be converted to UTF-16
* and passed to _wfopen().
*/
XSUM_API FILE* XSUM_fopen(const char* filename, const char* mode);
/*
* vfprintf() wrapper which prints UTF-8 strings to Windows consoles
* if applicable.
*/
XSUM_ATTRIBUTE((__format__(__printf__, 2, 0)))
XSUM_API int XSUM_vfprintf(FILE* stream, const char* format, va_list ap);
#ifdef __cplusplus
}
#endif
#endif /* XSUM_OS_SPECIFIC_H */
/*
* xxhsum - Command line interface for xxhash algorithms
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
#include "xsum_output.h"
#include "xsum_os_specific.h" /* XSUM_API */
int XSUM_logLevel = 2;
XSUM_ATTRIBUTE((__format__(__printf__, 1, 2)))
XSUM_API int XSUM_log(const char* format, ...)
{
int ret;
va_list ap;
va_start(ap, format);
ret = XSUM_vfprintf(stderr, format, ap);
va_end(ap);
return ret;
}
XSUM_ATTRIBUTE((__format__(__printf__, 1, 2)))
XSUM_API int XSUM_output(const char* format, ...)
{
int ret;
va_list ap;
va_start(ap, format);
ret = XSUM_vfprintf(stdout, format, ap);
va_end(ap);
return ret;
}
XSUM_ATTRIBUTE((__format__(__printf__, 2, 3)))
XSUM_API int XSUM_logVerbose(int minLevel, const char* format, ...)
{
if (XSUM_logLevel >= minLevel) {
int ret;
va_list ap;
va_start(ap, format);
ret = XSUM_vfprintf(stderr, format, ap);
va_end(ap);
return ret;
}
return 0;
}
/*
* xxhsum - Command line interface for xxhash algorithms
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
#ifndef XSUM_OUTPUT_H
#define XSUM_OUTPUT_H
#include "xsum_config.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* How verbose the output is.
*/
extern int XSUM_logLevel;
/*
* Same as fprintf(stderr, format, ...)
*/
XSUM_ATTRIBUTE((__format__(__printf__, 1, 2)))
XSUM_API int XSUM_log(const char *format, ...);
/*
* Like XSUM_log, but only outputs if XSUM_logLevel >= minLevel.
*/
XSUM_ATTRIBUTE((__format__(__printf__, 2, 3)))
XSUM_API int XSUM_logVerbose(int minLevel, const char *format, ...);
/*
* Same as printf(format, ...)
*/
XSUM_ATTRIBUTE((__format__(__printf__, 1, 2)))
XSUM_API int XSUM_output(const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif /* XSUM_OUTPUT_H */
This diff is collapsed.
/*
* xxhsum - Command line interface for xxhash algorithms
* Copyright (C) 2013-2021 Yann Collet
*
* GPL v2 License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* You can contact the author at:
* - xxHash homepage: https://www.xxhash.com
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
#ifndef XSUM_SANITY_CHECK_H
#define XSUM_SANITY_CHECK_H
#include "xsum_config.h" /* XSUM_API, XSUM_U8 */
#include <stddef.h> /* size_t */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Runs a series of self-tests.
*
* Exits if any of these tests fail, printing a message to stderr.
*
* If XSUM_NO_TESTS is defined to non-zero,
* this will instead print a warning if this is called (e.g. via xxhsum -b).
*/
XSUM_API void XSUM_sanityCheck(void);
/*
* Fills a test buffer with pseudorandom data.
*
* This is used in the sanity check and the benchmarks.
* Its values must not be changed.
*/
XSUM_API void XSUM_fillTestBuffer(XSUM_U8* buffer, size_t len);
#ifdef __cplusplus
}
#endif
#endif /* XSUM_SANITY_CHECK_H */
.TH "XXHSUM" "1" "December 2021" "xxhsum 0.8.1" "User Commands"
.SH "NAME"
\fBxxhsum\fR \- print or check xxHash non\-cryptographic checksums
.SH "SYNOPSIS"
\fBxxhsum [<OPTION>] \|\.\|\.\|\. [<FILE>] \|\.\|\.\|\.\fR \fBxxhsum \-b [<OPTION>] \|\.\|\.\|\.\fR
.P
\fBxxh32sum\fR is equivalent to \fBxxhsum \-H0\fR, \fBxxh64sum\fR is equivalent to \fBxxhsum \-H1\fR, \fBxxh128sum\fR is equivalent to \fBxxhsum \-H2\fR
.SH "DESCRIPTION"
Print or check xxHash (32, 64 or 128 bits) checksums\. When no \fIFILE\fR, read standard input, except if it\'s the console\. When \fIFILE\fR is \fB\-\fR, read standard input even if it\'s the console\.
.P
\fBxxhsum\fR supports a command line syntax similar but not identical to md5sum(1)\. Differences are: \fBxxhsum\fR doesn\'t have text/binary mode switch (\fB\-b\fR, \fB\-t\fR); \fBxxhsum\fR always treats files as binary file; \fBxxhsum\fR has a hash selection switch (\fB\-H\fR);
.P
As xxHash is a fast non\-cryptographic checksum algorithm, \fBxxhsum\fR should not be used for security related purposes\.
.P
\fBxxhsum \-b\fR invokes benchmark mode\. See \fIOPTIONS\fR and \fIEXAMPLES\fR for details\.
.SH "OPTIONS"
.TP
\fB\-V\fR, \fB\-\-version\fR
Displays xxhsum version and exits
.TP
\fB\-H\fR\fIHASHTYPE\fR
Hash selection\. \fIHASHTYPE\fR means \fB0\fR=XXH32, \fB1\fR=XXH64, \fB2\fR=XXH128, \fB3\fR=XXH3\. Note that \fB\-H3\fR triggers \fB\-\-tag\fR, which can\'t be skipped (this is to reduce risks of confusion with \fB\-H2\fR (\fBXXH64\fR))\. Alternatively, \fIHASHTYPE\fR \fB32\fR=XXH32, \fB64\fR=XXH64, \fB128\fR=XXH128\. Default value is \fB1\fR (64bits)
.TP
\fB\-\-tag\fR
Output in the BSD style\.
.TP
\fB\-\-little\-endian\fR
Set output hexadecimal checksum value as little endian convention\. By default, value is displayed as big endian\.
.TP
\fB\-h\fR, \fB\-\-help\fR
Displays help and exits
.P
\fBThe following four options are useful only when verifying checksums (\fB\-c\fR)\fR
.TP
\fB\-c\fR, \fB\-\-check\fR \fIFILE\fR
Read xxHash sums from \fIFILE\fR and check them
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Don\'t print OK for each successfully verified file
.TP
\fB\-\-strict\fR
Return an error code if any line in the file is invalid, not just if some checksums are wrong\. This policy is disabled by default, though UI will prompt an informational message if any line in the file is detected invalid\.
.TP
\fB\-\-status\fR
Don\'t output anything\. Status code shows success\.
.TP
\fB\-w\fR, \fB\-\-warn\fR
Emit a warning message about each improperly formatted checksum line\.
.P
\fBThe following options are useful only benchmark purpose\fR
.TP
\fB\-b\fR
Benchmark mode\. See \fIEXAMPLES\fR for details\.
.TP
\fB\-b#\fR
Specify ID of variant to be tested\. Multiple variants can be selected, separated by a \',\' comma\.
.TP
\fB\-B\fR\fIBLOCKSIZE\fR
Only useful for benchmark mode (\fB\-b\fR)\. See \fIEXAMPLES\fR for details\. \fIBLOCKSIZE\fR specifies benchmark mode\'s test data block size in bytes\. Default value is 102400
.TP
\fB\-i\fR\fIITERATIONS\fR
Only useful for benchmark mode (\fB\-b\fR)\. See \fIEXAMPLES\fR for details\. \fIITERATIONS\fR specifies number of iterations in benchmark\. Single iteration lasts approximately 1000 milliseconds\. Default value is 3
.SH "EXIT STATUS"
\fBxxhsum\fR exit \fB0\fR on success, \fB1\fR if at least one file couldn\'t be read or doesn\'t have the same checksum as the \fB\-c\fR option\.
.SH "EXAMPLES"
Output xxHash (64bit) checksum values of specific files to standard output
.IP "" 4
.nf
$ xxhsum \-H1 foo bar baz
.fi
.IP "" 0
.P
Output xxHash (32bit and 64bit) checksum values of specific files to standard output, and redirect it to \fBxyz\.xxh32\fR and \fBqux\.xxh64\fR
.IP "" 4
.nf
$ xxhsum \-H0 foo bar baz > xyz\.xxh32
$ xxhsum \-H1 foo bar baz > qux\.xxh64
.fi
.IP "" 0
.P
Read xxHash sums from specific files and check them
.IP "" 4
.nf
$ xxhsum \-c xyz\.xxh32 qux\.xxh64
.fi
.IP "" 0
.P
Benchmark xxHash algorithm\. By default, \fBxxhsum\fR benchmarks xxHash main variants on a synthetic sample of 100 KB, and print results into standard output\. The first column is the algorithm, the second column is the source data size in bytes, the third column is the number of hashes generated per second (throughput), and finally the last column translates speed in megabytes per second\.
.IP "" 4
.nf
$ xxhsum \-b
.fi
.IP "" 0
.P
In the following example, the sample to hash is set to 16384 bytes, the variants to be benched are selected by their IDs, and each benchmark test is repeated 10 times, for increased accuracy\.
.IP "" 4
.nf
$ xxhsum \-b1,2,3 \-i10 \-B16384
.fi
.IP "" 0
.SH "BUGS"
Report bugs at: https://github\.com/Cyan4973/xxHash/issues/
.SH "AUTHOR"
Yann Collet
.SH "SEE ALSO"
md5sum(1)
xxhsum(1) -- print or check xxHash non-cryptographic checksums
==============================================================
SYNOPSIS
--------
`xxhsum [<OPTION>] ... [<FILE>] ...`
`xxhsum -b [<OPTION>] ...`
`xxh32sum` is equivalent to `xxhsum -H0`,
`xxh64sum` is equivalent to `xxhsum -H1`,
`xxh128sum` is equivalent to `xxhsum -H2`.
DESCRIPTION
-----------
Print or check xxHash (32, 64 or 128 bits) checksums.
When no <FILE>, read standard input, except if it's the console.
When <FILE> is `-`, read standard input even if it's the console.
`xxhsum` supports a command line syntax similar but not identical to md5sum(1).
Differences are:
`xxhsum` doesn't have text/binary mode switch (`-b`, `-t`);
`xxhsum` always treats files as binary file;
`xxhsum` has a hash selection switch (`-H`);
As xxHash is a fast non-cryptographic checksum algorithm,
`xxhsum` should not be used for security related purposes.
`xxhsum -b` invokes benchmark mode. See [OPTIONS](#OPTIONS) and [EXAMPLES](#EXAMPLES) for details.
OPTIONS
-------
* `-V`, `--version`:
Displays xxhsum version and exits
* `-H`<HASHTYPE>:
Hash selection. <HASHTYPE> means `0`=XXH32, `1`=XXH64, `2`=XXH128, `3`=XXH3.
Note that `-H3` triggers `--tag`, which can't be skipped
(this is to reduce risks of confusion with `-H2` (`XXH64`)).
Alternatively, <HASHTYPE> `32`=XXH32, `64`=XXH64, `128`=XXH128.
Default value is `1` (XXH64)
* `--tag`:
Output in the BSD style.
* `--little-endian`:
Set output hexadecimal checksum value as little endian convention.
By default, value is displayed as big endian.
* `-h`, `--help`:
Displays help and exits
**The following four options are useful only when verifying checksums (`-c`)**
* `-c`, `--check` <FILE>:
Read xxHash sums from <FILE> and check them
* `-q`, `--quiet`:
Don't print OK for each successfully verified file
* `--strict`:
Return an error code if any line in the file is invalid,
not just if some checksums are wrong.
This policy is disabled by default,
though UI will prompt an informational message
if any line in the file is detected invalid.
* `--status`:
Don't output anything. Status code shows success.
* `-w`, `--warn`:
Emit a warning message about each improperly formatted checksum line.
**The following options are useful only benchmark purpose**
* `-b`:
Benchmark mode. See [EXAMPLES](#EXAMPLES) for details.
* `-b#`:
Specify ID of variant to be tested.
Multiple variants can be selected, separated by a ',' comma.
* `-B`<BLOCKSIZE>:
Only useful for benchmark mode (`-b`). See [EXAMPLES](#EXAMPLES) for details.
<BLOCKSIZE> specifies benchmark mode's test data block size in bytes.
Default value is 102400
* `-i`<ITERATIONS>:
Only useful for benchmark mode (`-b`). See [EXAMPLES](#EXAMPLES) for details.
<ITERATIONS> specifies number of iterations in benchmark. Single iteration
lasts approximately 1000 milliseconds. Default value is 3
EXIT STATUS
-----------
`xxhsum` exit `0` on success, `1` if at least one file couldn't be read or
doesn't have the same checksum as the `-c` option.
EXAMPLES
--------
Output xxHash (64bit) checksum values of specific files to standard output
$ xxhsum -H1 foo bar baz
Output xxHash (32bit and 64bit) checksum values of specific files to standard
output, and redirect it to `xyz.xxh32` and `qux.xxh64`
$ xxhsum -H0 foo bar baz > xyz.xxh32
$ xxhsum -H1 foo bar baz > qux.xxh64
Read xxHash sums from specific files and check them
$ xxhsum -c xyz.xxh32 qux.xxh64
Benchmark xxHash algorithm.
By default, `xxhsum` benchmarks xxHash main variants
on a synthetic sample of 100 KB,
and print results into standard output.
The first column is the algorithm,
the second column is the source data size in bytes,
the third column is the number of hashes generated per second (throughput),
and finally the last column translates speed in megabytes per second.
$ xxhsum -b
In the following example,
the sample to hash is set to 16384 bytes,
the variants to be benched are selected by their IDs,
and each benchmark test is repeated 10 times, for increased accuracy.
$ xxhsum -b1,2,3 -i10 -B16384
BUGS
----
Report bugs at: https://github.com/Cyan4973/xxHash/issues/
AUTHOR
------
Yann Collet
SEE ALSO
--------
md5sum(1)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
@PACKAGE_INIT@
include(${CMAKE_CURRENT_LIST_DIR}/xxHashTargets.cmake)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#build artefacts
collisionsTest
This diff is collapsed.
This diff is collapsed.
Put in this directory all hash algorithms to test
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment