digest-blake3 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +15 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/digest-blake3.gemspec +29 -0
- data/ext/digest/blake3/blake3.c +589 -0
- data/ext/digest/blake3/blake3.h +54 -0
- data/ext/digest/blake3/blake3_avx2.c +325 -0
- data/ext/digest/blake3/blake3_avx2_x86-64_unix.S +1800 -0
- data/ext/digest/blake3/blake3_avx2_x86-64_windows_gnu.S +1817 -0
- data/ext/digest/blake3/blake3_avx2_x86-64_windows_msvc.asm +1828 -0
- data/ext/digest/blake3/blake3_avx512.c +1204 -0
- data/ext/digest/blake3/blake3_avx512_x86-64_unix.S +2569 -0
- data/ext/digest/blake3/blake3_avx512_x86-64_windows_gnu.S +2615 -0
- data/ext/digest/blake3/blake3_avx512_x86-64_windows_msvc.asm +2634 -0
- data/ext/digest/blake3/blake3_dispatch.c +312 -0
- data/ext/digest/blake3/blake3_impl.h +167 -0
- data/ext/digest/blake3/blake3_neon.c +346 -0
- data/ext/digest/blake3/blake3_portable.c +168 -0
- data/ext/digest/blake3/blake3_ruby.c +38 -0
- data/ext/digest/blake3/blake3_sse41.c +559 -0
- data/ext/digest/blake3/blake3_sse41_x86-64_unix.S +2011 -0
- data/ext/digest/blake3/blake3_sse41_x86-64_windows_gnu.S +2057 -0
- data/ext/digest/blake3/blake3_sse41_x86-64_windows_msvc.asm +2077 -0
- data/ext/digest/blake3/extconf.rb +54 -0
- data/lib/digest/blake3/version.rb +7 -0
- data/lib/digest/blake3.rb +2 -0
- metadata +120 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require "mkmf"
|
2
|
+
|
3
|
+
unless have_header("ruby.h") && have_header("ruby/digest.h")
|
4
|
+
raise "Can't find ruby.h & ruby/digest.h, try installing the ruby-dev headers"
|
5
|
+
end
|
6
|
+
|
7
|
+
CONFIG["optflags"] = "-O3"
|
8
|
+
|
9
|
+
# we can't let create_makefile default to compiling all source files in the directory, because then
|
10
|
+
# it won't set the appropriate flags for the different versions. start by explicitly resetting the
|
11
|
+
# list to the files that we always want. blake3_ruby.o is the only one we've implemented ourselves
|
12
|
+
# - the rest are the blake3_* files from https://github.com/BLAKE3-team/BLAKE3/tree/master/c.
|
13
|
+
$objs = %w(
|
14
|
+
blake3_ruby.o
|
15
|
+
blake3.o
|
16
|
+
blake3_dispatch.o
|
17
|
+
blake3_portable.o
|
18
|
+
)
|
19
|
+
|
20
|
+
$confs = []
|
21
|
+
|
22
|
+
def check_supported_flags(flags, obj_if_enabled, def_if_disabled)
|
23
|
+
# run an arbitrary compilation test to see if these flags work; unfortunately there's no documented
|
24
|
+
# mkmf method to do that, but all the have_ methods accept optional flags, so we use have_header.
|
25
|
+
if have_header("blake3.h", nil, flags)
|
26
|
+
# we have to explicitly add a compilation rule for the object file to inject the additional flags -
|
27
|
+
# apart from the #{flags} subsitution, this is otherwise just what mkmf.rb puts in the .c.o rule.
|
28
|
+
$confs << "#{obj_if_enabled}: #{obj_if_enabled[0..-2]}c\n\t$(ECHO) compiling $(<)\n\t$(Q) #{COMPILE_C.sub "$(CC)", "$(CC) #{flags}"}\n\n"
|
29
|
+
$objs << obj_if_enabled
|
30
|
+
else
|
31
|
+
$defs << def_if_disabled
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
check_supported_flags("-msse4.1", "blake3_sse41.o", "-DBLAKE3_NO_SSE41")
|
36
|
+
check_supported_flags("-mavx2", "blake3_avx2.o", "-DBLAKE3_NO_AVX2")
|
37
|
+
check_supported_flags("-mavx512f -mavx512vl", "blake3_avx512.o", "-DBLAKE3_NO_AVX512")
|
38
|
+
|
39
|
+
if have_header("arm_neon.h")
|
40
|
+
$objs << "blake3_neon.o"
|
41
|
+
$defs << "-DBLAKE3_USE_NEON"
|
42
|
+
end
|
43
|
+
|
44
|
+
create_makefile("digest/blake3") do |conf|
|
45
|
+
# annoyingly, we have to repeat this line from the default output, so that it appears above the
|
46
|
+
# defines we add below and therefore becomes the default target. otherwise running 'make' with
|
47
|
+
# no arguments builds the first of our .o files instead of the library.
|
48
|
+
conf << "all: $(DLLIB)\n"
|
49
|
+
|
50
|
+
# then we can add our target definitions. we can't do this using the built-in mechanisms because
|
51
|
+
# there's no way to specify different compilation flags _per file_, which we need to do to build
|
52
|
+
# the multi-CPU support appropriately for blake3.
|
53
|
+
conf << $confs.join
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: digest-blake3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Will Bryant
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: Self-contained C implementation of BLAKE3.
|
56
|
+
email:
|
57
|
+
- will.bryant@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions:
|
60
|
+
- ext/digest/blake3/extconf.rb
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- digest-blake3.gemspec
|
73
|
+
- ext/digest/blake3/blake3.c
|
74
|
+
- ext/digest/blake3/blake3.h
|
75
|
+
- ext/digest/blake3/blake3_avx2.c
|
76
|
+
- ext/digest/blake3/blake3_avx2_x86-64_unix.S
|
77
|
+
- ext/digest/blake3/blake3_avx2_x86-64_windows_gnu.S
|
78
|
+
- ext/digest/blake3/blake3_avx2_x86-64_windows_msvc.asm
|
79
|
+
- ext/digest/blake3/blake3_avx512.c
|
80
|
+
- ext/digest/blake3/blake3_avx512_x86-64_unix.S
|
81
|
+
- ext/digest/blake3/blake3_avx512_x86-64_windows_gnu.S
|
82
|
+
- ext/digest/blake3/blake3_avx512_x86-64_windows_msvc.asm
|
83
|
+
- ext/digest/blake3/blake3_dispatch.c
|
84
|
+
- ext/digest/blake3/blake3_impl.h
|
85
|
+
- ext/digest/blake3/blake3_neon.c
|
86
|
+
- ext/digest/blake3/blake3_portable.c
|
87
|
+
- ext/digest/blake3/blake3_ruby.c
|
88
|
+
- ext/digest/blake3/blake3_sse41.c
|
89
|
+
- ext/digest/blake3/blake3_sse41_x86-64_unix.S
|
90
|
+
- ext/digest/blake3/blake3_sse41_x86-64_windows_gnu.S
|
91
|
+
- ext/digest/blake3/blake3_sse41_x86-64_windows_msvc.asm
|
92
|
+
- ext/digest/blake3/extconf.rb
|
93
|
+
- lib/digest/blake3.rb
|
94
|
+
- lib/digest/blake3/version.rb
|
95
|
+
homepage: https://github.com/willbryant/digest-blake3
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
- ext
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.7.6
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: BLAKE3 for Ruby
|
120
|
+
test_files: []
|