digest-xxhash 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +44 -12
- data/Rakefile +13 -2
- data/digest-xxhash.gemspec +9 -5
- data/ext/digest/xxhash/ext.c +572 -144
- data/ext/digest/xxhash/extconf.rb +20 -0
- data/ext/digest/xxhash/utils.h +15 -4
- data/ext/digest/xxhash/xxhash.h +5607 -157
- data/lib/digest/xxhash/version.rb +1 -1
- data/test/produce-vectors-with-ruby-xxhash.rb +5 -4
- data/test/produce-vectors-with-xxhsum.rb +112 -0
- data/test/test.rb +64 -33
- data/test/test.vectors +960 -462
- data/test/xxhsum.c.c0e86bc0.diff +424 -0
- metadata +33 -12
- data/.travis.yml +0 -6
- data/appveyor.yml +0 -19
- data/ext/digest/xxhash/xxhash.c +0 -888
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62b0480e6329d7a6f65173ab69262e2c3a0b26fed7d0eaa5d3500c86139b7103
|
4
|
+
data.tar.gz: 619a548d378beb8c0ab223843451452ea834272bb8df69971ecabf5bd6bd0ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b10f17d3d35c0b43662cc37c50b3bf3e008fc8305a3a6357c10f5fd588be3b56a75acd7e6feaeec409455691a010ef112543dbe454c6be66e7217efc26fda0
|
7
|
+
data.tar.gz: 995863f40af717ec3ba53f7e2429ed01d43ae677aeca1ac5ef9b29b998c1099cf995a3bc81d89a30862bd265cd3c752b999fe75037f07d86425561621bcd7ca2
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
# digest-xxhash
|
1
|
+
# digest-xxhash
|
2
2
|
|
3
|
-
This gem
|
4
|
-
|
5
|
-
Digest::Instance.
|
3
|
+
This gem provides XXH32, XXH64, XXH3_64bits and XXH3_128bits
|
4
|
+
functionalities for Ruby. It inherits Digest::Class and complies
|
5
|
+
with Digest::Instance's functional design.
|
6
6
|
|
7
|
-
Its core implementation
|
8
|
-
|
7
|
+
Its core implementation comes from the official source, which is in
|
8
|
+
https://github.com/Cyan4973/xxHash.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
Add this line to
|
12
|
+
Add this line to the application's Gemfile:
|
13
13
|
|
14
14
|
gem 'digest-xxhash'
|
15
15
|
|
@@ -17,10 +17,21 @@ And then execute:
|
|
17
17
|
|
18
18
|
$ bundle
|
19
19
|
|
20
|
-
|
20
|
+
It can also be installed manually with:
|
21
21
|
|
22
22
|
$ gem install digest-xxhash
|
23
23
|
|
24
|
+
The library can also be installed in Gentoo system-wide using 'layman':
|
25
|
+
|
26
|
+
# Fetch remote list of overlays, and add 'konsolebox' overlay
|
27
|
+
layman -f && layman -a konsolebox
|
28
|
+
|
29
|
+
# Unmask unstable keyword
|
30
|
+
echo 'dev-ruby/digest-xxhash' > /etc/portage/package.keywords/dev-ruby.digest-xxhash
|
31
|
+
|
32
|
+
# Merge package
|
33
|
+
emerge dev-ruby/digest-xxhash
|
34
|
+
|
24
35
|
## Example Usage
|
25
36
|
|
26
37
|
require 'digest/xxhash'
|
@@ -52,13 +63,34 @@ Or install it yourself as:
|
|
52
63
|
Digest::XXH64.new.reset("0123456789abcdef").update("12").update("34").hexdigest
|
53
64
|
=> "d7544504de216507"
|
54
65
|
|
66
|
+
Digest::XXH3_64bits.hexdigest("1234", "0123456789abcdef")
|
67
|
+
=> "4156724c7605b1be"
|
68
|
+
|
69
|
+
Digest::XXH3_64bits.new.reset_with_secret("abcd" * 34).update("1234").hexdigest
|
70
|
+
=> "f7bbdbf9ec8c6394"
|
71
|
+
|
72
|
+
Digest::XXH3_128bits.hexdigest("1234", "0123456789abcdef") # XXH3_128bits() only allows 64-bit seeds
|
73
|
+
=> "ad6108fb0b9a6b51b7f80d053c76c0fd"
|
74
|
+
|
75
|
+
Digest::XXH3_128bits.new.reset_with_secret("abcd" * 34).update("1234").hexdigest
|
76
|
+
=> "0d44dd7fde8ea2b4ba961e1a26f71f21"
|
77
|
+
|
78
|
+
## API Documentation
|
79
|
+
|
80
|
+
RubyGems.org provides autogenerated API documentation of the library in
|
81
|
+
https://www.rubydoc.info/gems/digest-xxhash/.
|
82
|
+
|
83
|
+
## Homepage
|
84
|
+
|
85
|
+
https://rubygems.org/gems/digest-xxhash
|
86
|
+
|
55
87
|
## Contributing
|
56
88
|
|
57
89
|
1. Fork it ( https://github.com/konsolebox/digest-xxhash-ruby/fork ).
|
58
|
-
2. Create
|
59
|
-
3. Commit
|
90
|
+
2. Create feature branch (`git checkout -b my-new-feature`).
|
91
|
+
3. Commit changes (`git commit -am 'Add some feature'`).
|
60
92
|
4. Push to the branch (`git push origin my-new-feature`).
|
61
93
|
5. Create a new Pull Request.
|
62
94
|
|
63
|
-
[![Build Status](https://
|
64
|
-
[![Build
|
95
|
+
[![Build Status](https://github.com/konsolebox/digest-xxhash-ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/konsolebox/digest-xxhash-ruby/actions/workflows/ruby.yml)
|
96
|
+
[![Build Status](https://ci.appveyor.com/api/projects/status/kb6hvlxjms3ftw7u?svg=true)](https://ci.appveyor.com/project/konsolebox/digest-xxhash-ruby)
|
data/Rakefile
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/extensiontask'
|
2
3
|
require 'rake/testtask'
|
3
4
|
|
4
5
|
# clean, clobber, compile, and compile:digest/xxhash
|
5
|
-
require 'rake/extensiontask'
|
6
6
|
Rake::ExtensionTask.new('digest/xxhash', Bundler::GemHelper.gemspec)
|
7
7
|
|
8
|
+
# install
|
9
|
+
Rake::Task[:install].clear
|
10
|
+
task :install => :build do
|
11
|
+
name = Bundler::GemHelper.gemspec.name
|
12
|
+
pkg_dir = File.join(Bundler::GemHelper.instance.base, "pkg")
|
13
|
+
built_gem = Dir.chdir(pkg_dir){ Dir.glob("#{name}-*.gem").sort_by{ |f| File.mtime(f) }.last }
|
14
|
+
gem_command = (ENV["GEM_COMMAND"].shellsplit rescue nil) || ["gem"]
|
15
|
+
options = ARGV.select{ |e| e =~ /\A--?/ }
|
16
|
+
Process.wait spawn(*gem_command, "install", File.join(pkg_dir, built_gem), *options)
|
17
|
+
end
|
18
|
+
|
8
19
|
# test
|
9
20
|
Rake::TestTask.new(:test => :compile) do |t|
|
10
21
|
t.test_files = FileList['test/test.rb']
|
@@ -17,7 +28,7 @@ task :clean do
|
|
17
28
|
rm_f list unless list.empty?
|
18
29
|
end
|
19
30
|
|
20
|
-
#
|
31
|
+
# default
|
21
32
|
task :default => :test
|
22
33
|
|
23
34
|
# Run `rake --tasks` for a list of tasks.
|
data/digest-xxhash.gemspec
CHANGED
@@ -9,20 +9,24 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = Digest::XXHash::VERSION
|
10
10
|
spec.authors = ["konsolebox"]
|
11
11
|
spec.email = ["konsolebox@gmail.com"]
|
12
|
-
spec.summary = "XXHash for Ruby"
|
13
|
-
spec.description =
|
12
|
+
spec.summary = "A Digest framework based XXHash library for Ruby"
|
13
|
+
spec.description = <<-EOF
|
14
|
+
This gem provides XXH32, XXH64, XXH3_64bits and XXH3_128bits
|
15
|
+
functionalities for Ruby. It inherits Digest::Class and complies
|
16
|
+
with Digest::Instance's functional design.
|
17
|
+
EOF
|
14
18
|
spec.homepage = "https://github.com/konsolebox/digest-xxhash-ruby"
|
15
19
|
spec.license = "MIT"
|
16
20
|
|
17
21
|
spec.required_ruby_version = '>= 2.2'
|
18
22
|
|
19
|
-
spec.files = `git ls-files -z`.split("\x0")
|
20
|
-
spec.executables = spec.files.grep(%r{^bin/})
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject{ |f| f =~ /\.yml$/ }
|
24
|
+
spec.executables = spec.files.grep(%r{^bin/}){ |f| File.basename(f) }
|
21
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
26
|
spec.require_paths = ["lib"]
|
23
27
|
|
24
28
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rake-compiler", "~> 1.0"
|
29
|
+
spec.add_development_dependency "rake-compiler", "~> 1.0", "!= 1.1.3", "!= 1.1.4", "!= 1.1.5"
|
26
30
|
spec.add_development_dependency "minitest", "~> 5.8"
|
27
31
|
|
28
32
|
spec.extensions = %w[ext/digest/xxhash/extconf.rb]
|