blake3ruby 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/Cargo.lock +53 -53
- data/Gemfile +10 -5
- data/Gemfile.lock +20 -7
- data/README.md +56 -13
- data/Rakefile +1 -0
- data/blake3ruby.gemspec +1 -0
- data/ext/blake3ruby/Cargo.toml +2 -2
- data/ext/blake3ruby/src/lib.rs +11 -10
- data/lib/blake3ruby/version.rb +1 -1
- data/sig/blake3ruby.rbs +13 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5437d6ba57d0304d82b1711735d70269be35ecb46cdc9b4290bdfd1898934e70
|
4
|
+
data.tar.gz: 2475ac8d199a359582eef531cdd599f36d54da282db215c18c13e8e88dd1362c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '087f1f5a295bd0bb7b227a97119fa2a23a3280ecc71dd0d5fa16b0c40710fddff0454c7a32e550675e6ea9cbfc941af8c3a1af24a96521f8fd75211da81cdb16'
|
7
|
+
data.tar.gz: 4e0cd090ba6bf3a79da4c8b8ba15b059f1c03d9b85459b9bfb6725ad62a4d383d99cd23ce4132e410e9f37e8ade7f0e704d70e4b5b771411a75970e27ed8f1bc
|
data/.rubocop.yml
CHANGED
data/Cargo.lock
CHANGED
@@ -45,15 +45,15 @@ dependencies = [
|
|
45
45
|
|
46
46
|
[[package]]
|
47
47
|
name = "bitflags"
|
48
|
-
version = "2.
|
48
|
+
version = "2.6.0"
|
49
49
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
50
|
-
checksum = "
|
50
|
+
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
51
51
|
|
52
52
|
[[package]]
|
53
53
|
name = "blake3"
|
54
|
-
version = "1.5.
|
54
|
+
version = "1.5.3"
|
55
55
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
56
|
-
checksum = "
|
56
|
+
checksum = "e9ec96fe9a81b5e365f9db71fe00edc4fe4ca2cc7dcb7861f0603012a7caa210"
|
57
57
|
dependencies = [
|
58
58
|
"arrayref",
|
59
59
|
"arrayvec",
|
@@ -64,7 +64,7 @@ dependencies = [
|
|
64
64
|
|
65
65
|
[[package]]
|
66
66
|
name = "blake3ruby"
|
67
|
-
version = "0.
|
67
|
+
version = "0.2.1"
|
68
68
|
dependencies = [
|
69
69
|
"blake3",
|
70
70
|
"hex",
|
@@ -73,9 +73,9 @@ dependencies = [
|
|
73
73
|
|
74
74
|
[[package]]
|
75
75
|
name = "cc"
|
76
|
-
version = "1.
|
76
|
+
version = "1.1.5"
|
77
77
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
78
|
-
checksum = "
|
78
|
+
checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052"
|
79
79
|
|
80
80
|
[[package]]
|
81
81
|
name = "cexpr"
|
@@ -94,9 +94,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
94
94
|
|
95
95
|
[[package]]
|
96
96
|
name = "clang-sys"
|
97
|
-
version = "1.
|
97
|
+
version = "1.8.1"
|
98
98
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
99
|
-
checksum = "
|
99
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
100
100
|
dependencies = [
|
101
101
|
"glob",
|
102
102
|
"libc",
|
@@ -111,9 +111,9 @@ checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
|
|
111
111
|
|
112
112
|
[[package]]
|
113
113
|
name = "either"
|
114
|
-
version = "1.
|
114
|
+
version = "1.13.0"
|
115
115
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
116
|
-
checksum = "
|
116
|
+
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
117
117
|
|
118
118
|
[[package]]
|
119
119
|
name = "glob"
|
@@ -138,9 +138,9 @@ dependencies = [
|
|
138
138
|
|
139
139
|
[[package]]
|
140
140
|
name = "lazy_static"
|
141
|
-
version = "1.
|
141
|
+
version = "1.5.0"
|
142
142
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
143
|
-
checksum = "
|
143
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
144
144
|
|
145
145
|
[[package]]
|
146
146
|
name = "lazycell"
|
@@ -150,15 +150,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
150
150
|
|
151
151
|
[[package]]
|
152
152
|
name = "libc"
|
153
|
-
version = "0.2.
|
153
|
+
version = "0.2.155"
|
154
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
155
|
-
checksum = "
|
155
|
+
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
156
156
|
|
157
157
|
[[package]]
|
158
158
|
name = "libloading"
|
159
|
-
version = "0.8.
|
159
|
+
version = "0.8.4"
|
160
160
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
161
|
-
checksum = "
|
161
|
+
checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
|
162
162
|
dependencies = [
|
163
163
|
"cfg-if",
|
164
164
|
"windows-targets",
|
@@ -166,9 +166,9 @@ dependencies = [
|
|
166
166
|
|
167
167
|
[[package]]
|
168
168
|
name = "magnus"
|
169
|
-
version = "0.
|
169
|
+
version = "0.7.1"
|
170
170
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
171
|
-
checksum = "
|
171
|
+
checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
|
172
172
|
dependencies = [
|
173
173
|
"magnus-macros",
|
174
174
|
"rb-sys",
|
@@ -189,9 +189,9 @@ dependencies = [
|
|
189
189
|
|
190
190
|
[[package]]
|
191
191
|
name = "memchr"
|
192
|
-
version = "2.7.
|
192
|
+
version = "2.7.4"
|
193
193
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
194
|
-
checksum = "
|
194
|
+
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
195
195
|
|
196
196
|
[[package]]
|
197
197
|
name = "minimal-lexical"
|
@@ -211,9 +211,9 @@ dependencies = [
|
|
211
211
|
|
212
212
|
[[package]]
|
213
213
|
name = "proc-macro2"
|
214
|
-
version = "1.0.
|
214
|
+
version = "1.0.86"
|
215
215
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
216
|
-
checksum = "
|
216
|
+
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
217
217
|
dependencies = [
|
218
218
|
"unicode-ident",
|
219
219
|
]
|
@@ -229,18 +229,18 @@ dependencies = [
|
|
229
229
|
|
230
230
|
[[package]]
|
231
231
|
name = "rb-sys"
|
232
|
-
version = "0.9.
|
232
|
+
version = "0.9.98"
|
233
233
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
234
|
-
checksum = "
|
234
|
+
checksum = "8914b2e6af10bd50dd7aaac8c5146872d3924d6012929b4ff504e988f6badd24"
|
235
235
|
dependencies = [
|
236
236
|
"rb-sys-build",
|
237
237
|
]
|
238
238
|
|
239
239
|
[[package]]
|
240
240
|
name = "rb-sys-build"
|
241
|
-
version = "0.9.
|
241
|
+
version = "0.9.98"
|
242
242
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
243
|
-
checksum = "
|
243
|
+
checksum = "12af68c9757d419b82d65a12b5db538990dfe9416049fea3f0ba4b9a8ca108cd"
|
244
244
|
dependencies = [
|
245
245
|
"bindgen",
|
246
246
|
"lazy_static",
|
@@ -259,9 +259,9 @@ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
|
259
259
|
|
260
260
|
[[package]]
|
261
261
|
name = "regex"
|
262
|
-
version = "1.10.
|
262
|
+
version = "1.10.5"
|
263
263
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
264
|
-
checksum = "
|
264
|
+
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
265
265
|
dependencies = [
|
266
266
|
"aho-corasick",
|
267
267
|
"memchr",
|
@@ -271,9 +271,9 @@ dependencies = [
|
|
271
271
|
|
272
272
|
[[package]]
|
273
273
|
name = "regex-automata"
|
274
|
-
version = "0.4.
|
274
|
+
version = "0.4.7"
|
275
275
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
276
|
-
checksum = "
|
276
|
+
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
277
277
|
dependencies = [
|
278
278
|
"aho-corasick",
|
279
279
|
"memchr",
|
@@ -282,9 +282,9 @@ dependencies = [
|
|
282
282
|
|
283
283
|
[[package]]
|
284
284
|
name = "regex-syntax"
|
285
|
-
version = "0.8.
|
285
|
+
version = "0.8.4"
|
286
286
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
287
|
-
checksum = "
|
287
|
+
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
288
288
|
|
289
289
|
[[package]]
|
290
290
|
name = "rustc-hash"
|
@@ -312,9 +312,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
312
312
|
|
313
313
|
[[package]]
|
314
314
|
name = "syn"
|
315
|
-
version = "2.0.
|
315
|
+
version = "2.0.71"
|
316
316
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
317
|
-
checksum = "
|
317
|
+
checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462"
|
318
318
|
dependencies = [
|
319
319
|
"proc-macro2",
|
320
320
|
"quote",
|
@@ -329,9 +329,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|
329
329
|
|
330
330
|
[[package]]
|
331
331
|
name = "windows-targets"
|
332
|
-
version = "0.52.
|
332
|
+
version = "0.52.6"
|
333
333
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
334
|
-
checksum = "
|
334
|
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
335
335
|
dependencies = [
|
336
336
|
"windows_aarch64_gnullvm",
|
337
337
|
"windows_aarch64_msvc",
|
@@ -345,48 +345,48 @@ dependencies = [
|
|
345
345
|
|
346
346
|
[[package]]
|
347
347
|
name = "windows_aarch64_gnullvm"
|
348
|
-
version = "0.52.
|
348
|
+
version = "0.52.6"
|
349
349
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
350
|
-
checksum = "
|
350
|
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
351
351
|
|
352
352
|
[[package]]
|
353
353
|
name = "windows_aarch64_msvc"
|
354
|
-
version = "0.52.
|
354
|
+
version = "0.52.6"
|
355
355
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
356
|
-
checksum = "
|
356
|
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
357
357
|
|
358
358
|
[[package]]
|
359
359
|
name = "windows_i686_gnu"
|
360
|
-
version = "0.52.
|
360
|
+
version = "0.52.6"
|
361
361
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
362
|
-
checksum = "
|
362
|
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
363
363
|
|
364
364
|
[[package]]
|
365
365
|
name = "windows_i686_gnullvm"
|
366
|
-
version = "0.52.
|
366
|
+
version = "0.52.6"
|
367
367
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
368
|
-
checksum = "
|
368
|
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
369
369
|
|
370
370
|
[[package]]
|
371
371
|
name = "windows_i686_msvc"
|
372
|
-
version = "0.52.
|
372
|
+
version = "0.52.6"
|
373
373
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
374
|
-
checksum = "
|
374
|
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
375
375
|
|
376
376
|
[[package]]
|
377
377
|
name = "windows_x86_64_gnu"
|
378
|
-
version = "0.52.
|
378
|
+
version = "0.52.6"
|
379
379
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
380
|
-
checksum = "
|
380
|
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
381
381
|
|
382
382
|
[[package]]
|
383
383
|
name = "windows_x86_64_gnullvm"
|
384
|
-
version = "0.52.
|
384
|
+
version = "0.52.6"
|
385
385
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
386
|
-
checksum = "
|
386
|
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
387
387
|
|
388
388
|
[[package]]
|
389
389
|
name = "windows_x86_64_msvc"
|
390
|
-
version = "0.52.
|
390
|
+
version = "0.52.6"
|
391
391
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
392
|
-
checksum = "
|
392
|
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
data/Gemfile
CHANGED
@@ -5,11 +5,16 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in blake3ruby.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem "rake", "~> 13.0"
|
9
|
-
|
10
|
-
gem "rake-compiler"
|
11
8
|
gem "rb_sys"
|
12
9
|
|
13
|
-
|
10
|
+
group :development do
|
11
|
+
gem "rake", "~> 13.0"
|
12
|
+
gem "rake-compiler"
|
13
|
+
end
|
14
14
|
|
15
|
-
|
15
|
+
group :test do
|
16
|
+
gem "rspec", "~> 3.0"
|
17
|
+
gem "rubocop", "~> 1.21"
|
18
|
+
gem "rubocop-rake", require: false
|
19
|
+
gem "rubocop-rspec", require: false
|
20
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
blake3ruby (0.
|
4
|
+
blake3ruby (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
json (2.7.2)
|
12
12
|
language_server-protocol (3.17.0.3)
|
13
13
|
parallel (1.25.1)
|
14
|
-
parser (3.3.
|
14
|
+
parser (3.3.4.0)
|
15
15
|
ast (~> 2.4.1)
|
16
16
|
racc
|
17
17
|
racc (1.8.0)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
rake (13.2.1)
|
20
20
|
rake-compiler (1.2.7)
|
21
21
|
rake
|
22
|
-
rb_sys (0.9.
|
22
|
+
rb_sys (0.9.98)
|
23
23
|
regexp_parser (2.9.2)
|
24
24
|
rexml (3.3.1)
|
25
25
|
strscan
|
@@ -36,25 +36,36 @@ GEM
|
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
37
|
rspec-support (~> 3.13.0)
|
38
38
|
rspec-support (3.13.1)
|
39
|
-
rubocop (1.
|
39
|
+
rubocop (1.65.0)
|
40
40
|
json (~> 2.3)
|
41
41
|
language_server-protocol (>= 3.17.0)
|
42
42
|
parallel (~> 1.10)
|
43
43
|
parser (>= 3.3.0.2)
|
44
44
|
rainbow (>= 2.2.2, < 4.0)
|
45
|
-
regexp_parser (>=
|
45
|
+
regexp_parser (>= 2.4, < 3.0)
|
46
46
|
rexml (>= 3.2.5, < 4.0)
|
47
47
|
rubocop-ast (>= 1.31.1, < 2.0)
|
48
48
|
ruby-progressbar (~> 1.7)
|
49
49
|
unicode-display_width (>= 2.4.0, < 3.0)
|
50
50
|
rubocop-ast (1.31.3)
|
51
51
|
parser (>= 3.3.1.0)
|
52
|
+
rubocop-rake (0.6.0)
|
53
|
+
rubocop (~> 1.0)
|
54
|
+
rubocop-rspec (3.0.3)
|
55
|
+
rubocop (~> 1.61)
|
52
56
|
ruby-progressbar (1.13.0)
|
53
57
|
strscan (3.1.0)
|
54
58
|
unicode-display_width (2.5.0)
|
55
59
|
|
56
60
|
PLATFORMS
|
57
|
-
|
61
|
+
aarch64-linux
|
62
|
+
aarch64-linux-musl
|
63
|
+
arm-linux
|
64
|
+
arm64-darwin
|
65
|
+
ruby
|
66
|
+
x86_64-darwin
|
67
|
+
x86_64-linux
|
68
|
+
x86_64-linux-musl
|
58
69
|
|
59
70
|
DEPENDENCIES
|
60
71
|
blake3ruby!
|
@@ -63,6 +74,8 @@ DEPENDENCIES
|
|
63
74
|
rb_sys
|
64
75
|
rspec (~> 3.0)
|
65
76
|
rubocop (~> 1.21)
|
77
|
+
rubocop-rake
|
78
|
+
rubocop-rspec
|
66
79
|
|
67
80
|
BUNDLED WITH
|
68
|
-
2.5.
|
81
|
+
2.5.15
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
This is a Ruby wrapper for the [BLAKE3](https://github.com/BLAKE3-team/BLAKE3) hash function written in Rust.
|
6
6
|
|
7
7
|
## Requirements
|
8
|
-
Tested on Ruby 3.1 and 3.
|
8
|
+
Tested on Ruby 3.1, 3.2 and 3.3.
|
9
9
|
You will need to have Rust installed on your system, and the `cargo` command available in your path.
|
10
10
|
See [here](https://www.rust-lang.org/tools/install) for instructions on how to install Rust.
|
11
11
|
Rust is only required to build the gem, not to use it.
|
@@ -36,7 +36,7 @@ Basic usage is similar to the `Digest` class in the Ruby standard library:
|
|
36
36
|
```ruby
|
37
37
|
require 'blake3ruby'
|
38
38
|
|
39
|
-
|
39
|
+
Digest::Blake3.hexdigest("Hello, world!") # => "ede5c0b10f2ec4979c69b52f61e42ff5b413519ce09be0f14d098dcfe5f6f98d"
|
40
40
|
```
|
41
41
|
|
42
42
|
If you want to use the streaming interface, you can use the `Blake3ruby::Hasher` class:
|
@@ -44,8 +44,8 @@ If you want to use the streaming interface, you can use the `Blake3ruby::Hasher`
|
|
44
44
|
```ruby
|
45
45
|
require 'blake3ruby'
|
46
46
|
|
47
|
-
hasher =
|
48
|
-
hasher.update("Hello, ") # => #<
|
47
|
+
hasher = Digest::Blake3::Hasher.new
|
48
|
+
hasher.update("Hello, ") # => #<Digest::Blake3::Hasher:0x00000001066f59a8> - returns self
|
49
49
|
hasher.update("world!")
|
50
50
|
hasher.finalize # => "ede5c0b10f2ec4979c69b52f61e42ff5b413519ce09be0f14d098dcfe5f6f98d"
|
51
51
|
```
|
@@ -60,9 +60,13 @@ The derive_key mode takes a context string and some key material (not a password
|
|
60
60
|
```ruby
|
61
61
|
require 'blake3ruby'
|
62
62
|
|
63
|
-
|
63
|
+
Digest::Blake3.derive_key("context", "input_key_material") # => "3eaa9796d6d3db5cd5de00d44e4888fccbf4f8c878dd6ccd0c374bded6c26405"
|
64
64
|
```
|
65
65
|
|
66
|
+
## Breaking Changes in Version 0.2.0
|
67
|
+
|
68
|
+
In versions 0.1.0 and 0.1.1, the Blake3ruby namespace was available. Starting from version 0.2.0, the Blake3 crypto digest has been moved to the Digest namespace where all standard Ruby digests are available. This change ensures consistency and better integration with the Ruby standard library.
|
69
|
+
|
66
70
|
## Performance
|
67
71
|
|
68
72
|
The performance of this gem is comparable to the performance of the [blake3](https://github.com/BLAKE3-team/BLAKE3)
|
@@ -70,14 +74,53 @@ crate, which is written in Rust.
|
|
70
74
|
|
71
75
|
The following benchmark was run on a 2015 MacBook Pro with a 2.5 GHz 4-Core Intel Core i7 processor and 16 GB of RAM.
|
72
76
|
```
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
SHA3-
|
77
|
-
SHA3-
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
MD5 (13 chars): 6.141045 0.086745 6.227790 ( 6.263524)
|
78
|
+
SHA1 (13 chars): 6.230957 0.080145 6.311102 ( 6.333384)
|
79
|
+
SHA3-256 (13 chars): 6.364485 0.093261 6.457746 ( 6.491053)
|
80
|
+
SHA3-384 (13 chars): 7.068870 0.151501 7.220371 ( 7.246571)
|
81
|
+
SHA3-512 (13 chars): 7.265794 0.152058 7.417852 ( 7.443591)
|
82
|
+
RMD160 (13 chars): 5.547123 0.075290 5.622413 ( 5.642165)
|
83
|
+
blake3 (13 chars): 2.747356 0.014433 2.761789 ( 2.772582)
|
84
|
+
|
85
|
+
For message length 13 chars:
|
86
|
+
Fastest: blake3 with 2.7725820001214743 seconds
|
87
|
+
Slowest: SHA3-512 with 7.44359099981375 seconds
|
88
|
+
user system total real
|
89
|
+
MD5 (44 chars): 5.861548 0.074899 5.936447 ( 5.959032)
|
90
|
+
SHA1 (44 chars): 5.944156 0.072394 6.016550 ( 6.038251)
|
91
|
+
SHA3-256 (44 chars): 6.446754 0.096381 6.543135 ( 6.570512)
|
92
|
+
SHA3-384 (44 chars): 7.083944 0.156259 7.240203 ( 7.268630)
|
93
|
+
SHA3-512 (44 chars): 7.213243 0.154452 7.367695 ( 7.396536)
|
94
|
+
RMD160 (44 chars): 5.589189 0.075830 5.665019 ( 5.689458)
|
95
|
+
blake3 (44 chars): 2.754475 0.014872 2.769347 ( 2.780263)
|
96
|
+
|
97
|
+
For message length 44 chars:
|
98
|
+
Fastest: blake3 with 2.7802629999350756 seconds
|
99
|
+
Slowest: SHA3-512 with 7.396536000072956 seconds
|
100
|
+
user system total real
|
101
|
+
MD5 (199 chars): 8.079411 0.088239 8.167650 ( 8.201427)
|
102
|
+
SHA1 (199 chars): 7.792639 0.082953 7.875592 ( 7.904909)
|
103
|
+
SHA3-256 (199 chars): 9.508372 0.106791 9.615163 ( 9.648153)
|
104
|
+
SHA3-384 (199 chars): 8.291785 0.160924 8.452709 ( 8.483978)
|
105
|
+
SHA3-512 (199 chars): 8.396180 0.160054 8.556234 ( 8.590455)
|
106
|
+
RMD160 (199 chars): 8.910650 0.087215 8.997865 ( 9.028016)
|
107
|
+
blake3 (199 chars): 3.796439 0.018845 3.815284 ( 3.829479)
|
108
|
+
|
109
|
+
For message length 199 chars:
|
110
|
+
Fastest: blake3 with 3.8294790000654757 seconds
|
111
|
+
Slowest: SHA3-256 with 9.648153000045568 seconds
|
112
|
+
user system total real
|
113
|
+
MD5 (1024 chars): 15.504161 0.114951 15.619112 ( 15.671606)
|
114
|
+
SHA1 (1024 chars): 13.007605 0.105566 13.113171 ( 13.163242)
|
115
|
+
SHA3-256 (1024 chars): 20.968764 0.162367 21.131131 ( 21.212766)
|
116
|
+
SHA3-384 (1024 chars): 17.255475 0.300950 17.556425 ( 17.728562)
|
117
|
+
SHA3-512 (1024 chars): 17.697881 0.400774 18.098655 ( 18.404827)
|
118
|
+
RMD160 (1024 chars): 23.639904 0.458113 24.098017 ( 24.535302)
|
119
|
+
blake3 (1024 chars): 8.123303 0.178863 8.302166 ( 8.499843)
|
120
|
+
|
121
|
+
For message length 1024 chars:
|
122
|
+
Fastest: blake3 with 8.499842999968678 seconds
|
123
|
+
Slowest: RMD160 with 24.535302000120282 seconds
|
81
124
|
```
|
82
125
|
|
83
126
|
Another benchmark was run on a 2022 MacBook Pro with a Apple M1 processor and 16 GB of RAM.
|
data/Rakefile
CHANGED
data/blake3ruby.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.metadata["homepage_uri"] = spec.homepage
|
19
19
|
spec.metadata["source_code_uri"] = "https://github.com/Nightforge/blake3ruby"
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
20
21
|
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/ext/blake3ruby/Cargo.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "blake3ruby"
|
3
|
-
version = "0.
|
3
|
+
version = "0.2.1"
|
4
4
|
edition = "2021"
|
5
5
|
authors = ["Nightforge <modo00@gmail.com>"]
|
6
6
|
publish = false
|
@@ -9,7 +9,7 @@ publish = false
|
|
9
9
|
crate-type = ["cdylib"]
|
10
10
|
|
11
11
|
[dependencies]
|
12
|
-
magnus = { version = "0.
|
12
|
+
magnus = { version = "0.7.1" }
|
13
13
|
hex = { version = "0.4.3" }
|
14
14
|
blake3 = { version = "1.5.1" }
|
15
15
|
|
data/ext/blake3ruby/src/lib.rs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
use magnus::{define_module,
|
1
|
+
use magnus::{define_module, class, function, method, prelude::*, Error};
|
2
2
|
|
3
3
|
fn hexdigest(subject: String) -> String {
|
4
4
|
let hash = blake3::hash(subject.as_bytes());
|
5
|
-
return hash.to_string()
|
5
|
+
return hash.to_string();
|
6
6
|
}
|
7
7
|
|
8
8
|
fn derive_key(context: String, key: String) -> String {
|
@@ -15,7 +15,7 @@ struct Hasher {
|
|
15
15
|
hasher: blake3::Hasher,
|
16
16
|
}
|
17
17
|
|
18
|
-
#[magnus::wrap(class = "Hasher")]
|
18
|
+
#[magnus::wrap(class = "Digest::Blake3::Hasher")]
|
19
19
|
struct MutHasher(std::cell::RefCell<Hasher>);
|
20
20
|
|
21
21
|
impl MutHasher {
|
@@ -28,26 +28,27 @@ impl MutHasher {
|
|
28
28
|
|
29
29
|
fn update(&self, subject: String) -> Self {
|
30
30
|
self.0.borrow_mut().hasher.update(subject.as_bytes());
|
31
|
-
return Self(self.0.clone())
|
31
|
+
return Self(self.0.clone());
|
32
32
|
}
|
33
33
|
|
34
34
|
fn finalize(&self) -> String {
|
35
35
|
let hash = self.0.borrow().hasher.finalize();
|
36
|
-
return hash.to_string()
|
36
|
+
return hash.to_string();
|
37
37
|
}
|
38
38
|
}
|
39
39
|
|
40
40
|
#[magnus::init]
|
41
41
|
fn init() -> Result<(), Error> {
|
42
|
-
let
|
43
|
-
|
44
|
-
|
42
|
+
let digest = define_module("Digest")?;
|
43
|
+
let blake3 = digest.define_module("Blake3")?;
|
44
|
+
|
45
|
+
blake3.define_singleton_method("hexdigest", function!(hexdigest, 1))?;
|
46
|
+
blake3.define_singleton_method("derive_key", function!(derive_key, 2))?;
|
45
47
|
|
46
|
-
let class = define_class("Hasher", class::object())?;
|
48
|
+
let class = blake3.define_class("Hasher", class::object())?;
|
47
49
|
class.define_singleton_method("new", function!(MutHasher::new, 0))?;
|
48
50
|
class.define_method("update", method!(MutHasher::update, 1))?;
|
49
51
|
class.define_method("finalize", method!(MutHasher::finalize, 0))?;
|
50
52
|
|
51
|
-
blake3ruby.define_class("Hasher", class)?;
|
52
53
|
Ok(())
|
53
54
|
}
|
data/lib/blake3ruby/version.rb
CHANGED
data/sig/blake3ruby.rbs
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
module Blake3ruby
|
2
2
|
VERSION: String
|
3
|
-
|
3
|
+
end
|
4
|
+
|
5
|
+
module Digest
|
6
|
+
module Blake3
|
7
|
+
def self.hexdigest(subject: String) -> String
|
8
|
+
def self.derive_key(context: String, key: String) -> String
|
9
|
+
|
10
|
+
class Hasher
|
11
|
+
def self.new: () -> Digest::Blake3::Hasher
|
12
|
+
def update: (subject: String) -> Digest::Blake3::Hasher
|
13
|
+
def finalize: () -> String
|
14
|
+
end
|
15
|
+
end
|
4
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blake3ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nightforge
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby bindings for the blake3 hash function using the Rust implementation
|
14
14
|
email:
|
@@ -42,6 +42,7 @@ licenses:
|
|
42
42
|
metadata:
|
43
43
|
homepage_uri: https://github.com/Nightforge/blake3ruby
|
44
44
|
source_code_uri: https://github.com/Nightforge/blake3ruby
|
45
|
+
rubygems_mfa_required: 'true'
|
45
46
|
post_install_message:
|
46
47
|
rdoc_options: []
|
47
48
|
require_paths:
|
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
58
|
- !ruby/object:Gem::Version
|
58
59
|
version: 3.3.11
|
59
60
|
requirements: []
|
60
|
-
rubygems_version: 3.5.
|
61
|
+
rubygems_version: 3.5.15
|
61
62
|
signing_key:
|
62
63
|
specification_version: 4
|
63
64
|
summary: Ruby bindings for the blake3 hash function
|