-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,177 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Set the default behavior | ||
* text eol=lf | ||
|
||
# Explicitly declare source files | ||
*.c text eol=lf | ||
*.h text eol=lf | ||
|
||
# Denote files that should not be modified. | ||
*.odt binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
language: c | ||
compiler: gcc | ||
script: make -B test-all | ||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq gcc-arm-linux-gnueabi | ||
- sudo apt-get install -qq clang | ||
- sudo apt-get install -qq g++-multilib | ||
- sudo apt-get install -qq gcc-multilib | ||
- sudo apt-get install -qq valgrind | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
xxHash Library | ||
Copyright (c) 2012-2014, Yann Collet | ||
All rights reserved. | ||
|
||
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# ################################################################ | ||
# xxHash Makefile | ||
# Copyright (C) Yann Collet 2012-2015 | ||
# | ||
# 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 source repository : http://code.google.com/p/xxhash/ | ||
# ################################################################ | ||
# xxhsum : provides 32/64 bits hash of one or multiple files, or stdin | ||
# ################################################################ | ||
|
||
CFLAGS ?= -O3 | ||
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic | ||
FLAGS := -I. $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MOREFLAGS) | ||
|
||
|
||
# Define *.exe as extension for Windows systems | ||
ifneq (,$(filter Windows%,$(OS))) | ||
EXT =.exe | ||
else | ||
EXT = | ||
endif | ||
|
||
.PHONY: clean all | ||
|
||
default: xxhsum | ||
|
||
all: xxhsum xxhsum32 | ||
|
||
xxhsum: xxhash.c xxhsum.c | ||
$(CC) $(FLAGS) $^ -o $@$(EXT) | ||
ln -sf $@ xxh32sum | ||
ln -sf $@ xxh64sum | ||
|
||
xxhsum32: xxhash.c xxhsum.c | ||
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT) | ||
|
||
test: clean xxhsum | ||
# stdin | ||
./xxhsum < xxhash.c | ||
# multiple files | ||
./xxhsum * | ||
# internal bench | ||
./xxhsum -bi1 | ||
# file bench | ||
./xxhsum -bi1 xxhash.c | ||
# memory tests | ||
valgrind --leak-check=yes --error-exitcode=1 ./xxhsum -bi1 xxhash.c | ||
valgrind --leak-check=yes --error-exitcode=1 ./xxhsum -H0 xxhash.c | ||
valgrind --leak-check=yes --error-exitcode=1 ./xxhsum -H1 xxhash.c | ||
|
||
test32: clean xxhsum32 | ||
@echo ---- test 32-bits ---- | ||
./xxhsum32 -bi1 xxhash.c | ||
|
||
armtest: clean | ||
@echo ---- test ARM compilation ---- | ||
$(MAKE) xxhsum CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror" | ||
|
||
clangtest: clean | ||
@echo ---- test clang compilation ---- | ||
$(MAKE) all CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion" | ||
|
||
gpptest: clean | ||
@echo ---- test g++ compilation ---- | ||
$(MAKE) all CC=g++ CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" | ||
|
||
sanitize: clean | ||
@echo ---- check undefined behavior - sanitize ---- | ||
$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined" | ||
|
||
staticAnalyze: clean | ||
@echo ---- static analyzer - scan-build ---- | ||
scan-build --status-bugs -v $(MAKE) all MOREFLAGS=-g | ||
|
||
test-all: test test32 armtest clangtest gpptest sanitize staticAnalyze | ||
|
||
clean: | ||
@rm -f core *.o xxhsum$(EXT) xxhsum32$(EXT) xxh32sum xxh64sum | ||
@echo cleaning completed | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
xxHash - Extremely fast hash algorithm | ||
====================================== | ||
|
||
xxHash is an Extremely fast Hash algorithm, running at RAM speed limits. | ||
It successfully completes the [SMHasher](http://code.google.com/p/smhasher/wiki/SMHasher) test suite | ||
which evaluates collision, dispersion and randomness qualities of hash functions. | ||
|
||
|Branch |Status | | ||
|------------|---------| | ||
|master | [![Build Status](https://travis-ci.org/Cyan4973/xxHash.svg?branch=master)](https://travis-ci.org/Cyan4973/xxHash?branch=master) | | ||
|dev | [![Build Status](https://travis-ci.org/Cyan4973/xxHash.svg?branch=dev)](https://travis-ci.org/Cyan4973/xxHash?branch=dev) | | ||
|
||
> **Branch Policy:** | ||
> - The "master" branch is considered stable, at all times. | ||
> - The "dev" branch is the one where all contributions must be merged | ||
before being promoted to master. | ||
> + If you plan to propose a patch, please commit into the "dev" branch, | ||
or its own feature branch. | ||
Direct commit to "master" are not permitted. | ||
|
||
|
||
Benchmarks | ||
------------------------- | ||
|
||
The benchmark uses SMHasher speed test, compiled with Visual 2010 on a Windows Seven 32-bits box. | ||
The reference system uses a Core 2 Duo @3GHz | ||
|
||
|
||
| Name | Speed | Quality | Author | | ||
|---------------|----------|:-------:|------------------| | ||
| xxHash | 5.4 GB/s | 10 | Y.C. | | ||
| MurmurHash 3a | 2.7 GB/s | 10 | Austin Appleby | | ||
| SBox | 1.4 GB/s | 9 | Bret Mulvey | | ||
| Lookup3 | 1.2 GB/s | 9 | Bob Jenkins | | ||
| CityHash64 | 1.05 GB/s| 10 | Pike & Alakuijala| | ||
| FNV | 0.55 GB/s| 5 | Fowler, Noll, Vo | | ||
| CRC32 | 0.43 GB/s| 9 | | | ||
| MD5-32 | 0.33 GB/s| 10 | Ronald L.Rivest | | ||
| SHA1-32 | 0.28 GB/s| 10 | | | ||
|
||
|
||
Q.Score is a measure of quality of the hash function. | ||
It depends on successfully passing SMHasher test set. | ||
10 is a perfect score. | ||
Algorithms with a score < 5 are not listed on this table. | ||
|
||
A new version, XXH64, has been created thanks to Mathias Westerdahl's contribution, | ||
which offers superior speed and dispersion for 64-bits systems. | ||
Note however that 32-bits applications will still run faster using the 32-bits version. | ||
|
||
SMHasher speed test, compiled using GCC 4.8.2, on Linux Mint 64-bits. | ||
The reference system uses a Core i5-3340M @2.7GHz | ||
|
||
| Version | Speed on 64-bits | Speed on 32-bits | | ||
|------------|------------------|------------------| | ||
| XXH64 | 13.8 GB/s | 1.9 GB/s | | ||
| XXH32 | 6.8 GB/s | 6.0 GB/s | | ||
|
||
|
||
### License | ||
|
||
The library files `xxhash.c` and `xxhash.h` are BSD licensed. | ||
The utility `xxhsum` is GPL licensed. | ||
|
||
|
||
### Other languages | ||
|
||
Beyond the C reference version, | ||
xxHash is also available on many programming languages, | ||
thanks to great contributors. | ||
They are [listed here](https://code.google.com/p/xxhash/). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
cmake_policy(VERSION 2.6) | ||
|
||
project(xxhash) | ||
|
||
set(XXHASH_LIB_VERSION "0.42.0") | ||
set(XXHASH_LIB_SOVERSION "0") | ||
|
||
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries") | ||
if(BUILD_STATIC_LIBS) | ||
add_library(xxhashstatic ../xxhash.c) | ||
set_target_properties(xxhashstatic PROPERTIES OUTPUT_NAME xxhash) | ||
endif(BUILD_STATIC_LIBS) | ||
|
||
add_library(xxhash SHARED ../xxhash.c) | ||
set_target_properties(xxhash PROPERTIES | ||
COMPILE_DEFINITIONS "XXHASH_EXPORT" | ||
VERSION "${XXHASH_LIB_VERSION}" | ||
SOVERSION "${XXHASH_LIB_SOVERSION}") | ||
|
||
INSTALL(FILES ../xxhash.h DESTINATION include) | ||
INSTALL(TARGETS xxhash DESTINATION lib) |
Oops, something went wrong.