blake3ruby 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ea65ad9eed7d8b665c35efc4b6430cddf628c389543488e2ef932c2cdec07de0
4
+ data.tar.gz: 8ce3c42a94daeed9fd1086366e155c5305b18a8668d5d40fc713144bd672a5d9
5
+ SHA512:
6
+ metadata.gz: f6c71d819c42a2057cd43edaed6af1ae17c0da70c521ef872289e8f4f08f8fb31446759b415face48194395199c02747e9c43a957366218cb8a9d376fc95b512
7
+ data.tar.gz: d287fd094c98555f12de746f42a2db3c108b685dcd454451929aebafae7acbd06d6e242f2138c780a874a3e405befcd8c6375ae6e67b5b44d80c33c3f65c449c
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at evgenii.s@bdswiss.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Cargo.lock ADDED
@@ -0,0 +1,380 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "0.7.20"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "arrayref"
16
+ version = "0.3.7"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
19
+
20
+ [[package]]
21
+ name = "arrayvec"
22
+ version = "0.7.2"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
25
+
26
+ [[package]]
27
+ name = "bindgen"
28
+ version = "0.60.1"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6"
31
+ dependencies = [
32
+ "bitflags",
33
+ "cexpr",
34
+ "clang-sys",
35
+ "lazy_static",
36
+ "lazycell",
37
+ "peeking_take_while",
38
+ "proc-macro2",
39
+ "quote",
40
+ "regex",
41
+ "rustc-hash",
42
+ "shlex",
43
+ ]
44
+
45
+ [[package]]
46
+ name = "bitflags"
47
+ version = "1.3.2"
48
+ source = "registry+https://github.com/rust-lang/crates.io-index"
49
+ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
50
+
51
+ [[package]]
52
+ name = "blake3"
53
+ version = "1.3.3"
54
+ source = "registry+https://github.com/rust-lang/crates.io-index"
55
+ checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef"
56
+ dependencies = [
57
+ "arrayref",
58
+ "arrayvec",
59
+ "cc",
60
+ "cfg-if",
61
+ "constant_time_eq",
62
+ "digest",
63
+ ]
64
+
65
+ [[package]]
66
+ name = "blake3ruby"
67
+ version = "0.1.0"
68
+ dependencies = [
69
+ "blake3",
70
+ "hex",
71
+ "magnus",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "block-buffer"
76
+ version = "0.10.4"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
79
+ dependencies = [
80
+ "generic-array",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "cc"
85
+ version = "1.0.79"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
88
+
89
+ [[package]]
90
+ name = "cexpr"
91
+ version = "0.6.0"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
94
+ dependencies = [
95
+ "nom",
96
+ ]
97
+
98
+ [[package]]
99
+ name = "cfg-if"
100
+ version = "1.0.0"
101
+ source = "registry+https://github.com/rust-lang/crates.io-index"
102
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
103
+
104
+ [[package]]
105
+ name = "clang-sys"
106
+ version = "1.6.0"
107
+ source = "registry+https://github.com/rust-lang/crates.io-index"
108
+ checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a"
109
+ dependencies = [
110
+ "glob",
111
+ "libc",
112
+ "libloading",
113
+ ]
114
+
115
+ [[package]]
116
+ name = "constant_time_eq"
117
+ version = "0.2.5"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b"
120
+
121
+ [[package]]
122
+ name = "crypto-common"
123
+ version = "0.1.6"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
126
+ dependencies = [
127
+ "generic-array",
128
+ "typenum",
129
+ ]
130
+
131
+ [[package]]
132
+ name = "digest"
133
+ version = "0.10.6"
134
+ source = "registry+https://github.com/rust-lang/crates.io-index"
135
+ checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
136
+ dependencies = [
137
+ "block-buffer",
138
+ "crypto-common",
139
+ "subtle",
140
+ ]
141
+
142
+ [[package]]
143
+ name = "generic-array"
144
+ version = "0.14.6"
145
+ source = "registry+https://github.com/rust-lang/crates.io-index"
146
+ checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
147
+ dependencies = [
148
+ "typenum",
149
+ "version_check",
150
+ ]
151
+
152
+ [[package]]
153
+ name = "glob"
154
+ version = "0.3.1"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
157
+
158
+ [[package]]
159
+ name = "hex"
160
+ version = "0.4.3"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
163
+
164
+ [[package]]
165
+ name = "lazy_static"
166
+ version = "1.4.0"
167
+ source = "registry+https://github.com/rust-lang/crates.io-index"
168
+ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
169
+
170
+ [[package]]
171
+ name = "lazycell"
172
+ version = "1.3.0"
173
+ source = "registry+https://github.com/rust-lang/crates.io-index"
174
+ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
175
+
176
+ [[package]]
177
+ name = "libc"
178
+ version = "0.2.140"
179
+ source = "registry+https://github.com/rust-lang/crates.io-index"
180
+ checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
181
+
182
+ [[package]]
183
+ name = "libloading"
184
+ version = "0.7.4"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
187
+ dependencies = [
188
+ "cfg-if",
189
+ "winapi",
190
+ ]
191
+
192
+ [[package]]
193
+ name = "magnus"
194
+ version = "0.5.2"
195
+ source = "registry+https://github.com/rust-lang/crates.io-index"
196
+ checksum = "f3fda351681130b40996b3e40592565b5e44ef1a677c45ea3768ed223b5918a5"
197
+ dependencies = [
198
+ "magnus-macros",
199
+ "rb-sys",
200
+ "rb-sys-env",
201
+ ]
202
+
203
+ [[package]]
204
+ name = "magnus-macros"
205
+ version = "0.4.0"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "85aa71c9891b2732ff1157e1860a1ee578459fd25811fd3d72cc6e32b3fbdfea"
208
+ dependencies = [
209
+ "proc-macro2",
210
+ "quote",
211
+ "syn",
212
+ ]
213
+
214
+ [[package]]
215
+ name = "memchr"
216
+ version = "2.5.0"
217
+ source = "registry+https://github.com/rust-lang/crates.io-index"
218
+ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
219
+
220
+ [[package]]
221
+ name = "minimal-lexical"
222
+ version = "0.2.1"
223
+ source = "registry+https://github.com/rust-lang/crates.io-index"
224
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
225
+
226
+ [[package]]
227
+ name = "nom"
228
+ version = "7.1.3"
229
+ source = "registry+https://github.com/rust-lang/crates.io-index"
230
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
231
+ dependencies = [
232
+ "memchr",
233
+ "minimal-lexical",
234
+ ]
235
+
236
+ [[package]]
237
+ name = "peeking_take_while"
238
+ version = "0.1.2"
239
+ source = "registry+https://github.com/rust-lang/crates.io-index"
240
+ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
241
+
242
+ [[package]]
243
+ name = "proc-macro2"
244
+ version = "1.0.53"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73"
247
+ dependencies = [
248
+ "unicode-ident",
249
+ ]
250
+
251
+ [[package]]
252
+ name = "quote"
253
+ version = "1.0.26"
254
+ source = "registry+https://github.com/rust-lang/crates.io-index"
255
+ checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
256
+ dependencies = [
257
+ "proc-macro2",
258
+ ]
259
+
260
+ [[package]]
261
+ name = "rb-sys"
262
+ version = "0.9.70"
263
+ source = "registry+https://github.com/rust-lang/crates.io-index"
264
+ checksum = "dd532ce4ab93abcabd4b92d0eb1df5c02f64d3624b713e2bcf6a4186847f2c65"
265
+ dependencies = [
266
+ "rb-sys-build",
267
+ ]
268
+
269
+ [[package]]
270
+ name = "rb-sys-build"
271
+ version = "0.9.70"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "6959d6f87715ddb2854d833039aa22b06bbab3c3d63bb1df22e6da198e8390c5"
274
+ dependencies = [
275
+ "bindgen",
276
+ "lazy_static",
277
+ "proc-macro2",
278
+ "quote",
279
+ "regex",
280
+ "shell-words",
281
+ "syn",
282
+ ]
283
+
284
+ [[package]]
285
+ name = "rb-sys-env"
286
+ version = "0.1.2"
287
+ source = "registry+https://github.com/rust-lang/crates.io-index"
288
+ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
289
+
290
+ [[package]]
291
+ name = "regex"
292
+ version = "1.7.3"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
295
+ dependencies = [
296
+ "aho-corasick",
297
+ "memchr",
298
+ "regex-syntax",
299
+ ]
300
+
301
+ [[package]]
302
+ name = "regex-syntax"
303
+ version = "0.6.29"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
306
+
307
+ [[package]]
308
+ name = "rustc-hash"
309
+ version = "1.1.0"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
312
+
313
+ [[package]]
314
+ name = "shell-words"
315
+ version = "1.1.0"
316
+ source = "registry+https://github.com/rust-lang/crates.io-index"
317
+ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
318
+
319
+ [[package]]
320
+ name = "shlex"
321
+ version = "1.1.0"
322
+ source = "registry+https://github.com/rust-lang/crates.io-index"
323
+ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
324
+
325
+ [[package]]
326
+ name = "subtle"
327
+ version = "2.4.1"
328
+ source = "registry+https://github.com/rust-lang/crates.io-index"
329
+ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
330
+
331
+ [[package]]
332
+ name = "syn"
333
+ version = "1.0.109"
334
+ source = "registry+https://github.com/rust-lang/crates.io-index"
335
+ checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
336
+ dependencies = [
337
+ "proc-macro2",
338
+ "quote",
339
+ "unicode-ident",
340
+ ]
341
+
342
+ [[package]]
343
+ name = "typenum"
344
+ version = "1.16.0"
345
+ source = "registry+https://github.com/rust-lang/crates.io-index"
346
+ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
347
+
348
+ [[package]]
349
+ name = "unicode-ident"
350
+ version = "1.0.8"
351
+ source = "registry+https://github.com/rust-lang/crates.io-index"
352
+ checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
353
+
354
+ [[package]]
355
+ name = "version_check"
356
+ version = "0.9.4"
357
+ source = "registry+https://github.com/rust-lang/crates.io-index"
358
+ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
359
+
360
+ [[package]]
361
+ name = "winapi"
362
+ version = "0.3.9"
363
+ source = "registry+https://github.com/rust-lang/crates.io-index"
364
+ checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
365
+ dependencies = [
366
+ "winapi-i686-pc-windows-gnu",
367
+ "winapi-x86_64-pc-windows-gnu",
368
+ ]
369
+
370
+ [[package]]
371
+ name = "winapi-i686-pc-windows-gnu"
372
+ version = "0.4.0"
373
+ source = "registry+https://github.com/rust-lang/crates.io-index"
374
+ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
375
+
376
+ [[package]]
377
+ name = "winapi-x86_64-pc-windows-gnu"
378
+ version = "0.4.0"
379
+ source = "registry+https://github.com/rust-lang/crates.io-index"
380
+ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
data/Cargo.toml ADDED
@@ -0,0 +1,7 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/blake3ruby"]
7
+ resolver = "2"
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in blake3ruby.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rake-compiler"
11
+ gem "rb_sys"
12
+
13
+ gem "rspec", "~> 3.0"
14
+
15
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ blake3ruby (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ json (2.6.3)
12
+ parallel (1.22.1)
13
+ parser (3.2.1.1)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.1.1)
16
+ rake (13.0.6)
17
+ rake-compiler (1.2.1)
18
+ rake
19
+ rb_sys (0.9.70)
20
+ regexp_parser (2.7.0)
21
+ rexml (3.2.5)
22
+ rspec (3.12.0)
23
+ rspec-core (~> 3.12.0)
24
+ rspec-expectations (~> 3.12.0)
25
+ rspec-mocks (~> 3.12.0)
26
+ rspec-core (3.12.1)
27
+ rspec-support (~> 3.12.0)
28
+ rspec-expectations (3.12.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.12.0)
31
+ rspec-mocks (3.12.4)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.12.0)
34
+ rspec-support (3.12.0)
35
+ rubocop (1.48.1)
36
+ json (~> 2.3)
37
+ parallel (~> 1.10)
38
+ parser (>= 3.2.0.0)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ regexp_parser (>= 1.8, < 3.0)
41
+ rexml (>= 3.2.5, < 4.0)
42
+ rubocop-ast (>= 1.26.0, < 2.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (>= 2.4.0, < 3.0)
45
+ rubocop-ast (1.28.0)
46
+ parser (>= 3.2.1.0)
47
+ ruby-progressbar (1.13.0)
48
+ unicode-display_width (2.4.2)
49
+
50
+ PLATFORMS
51
+ x86_64-darwin-21
52
+
53
+ DEPENDENCIES
54
+ blake3ruby!
55
+ rake (~> 13.0)
56
+ rake-compiler
57
+ rb_sys
58
+ rspec (~> 3.0)
59
+ rubocop (~> 1.21)
60
+
61
+ BUNDLED WITH
62
+ 2.4.7
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2023 Nightforge and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # Blake3ruby
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/blake3ruby.svg)](https://badge.fury.io/rb/blake3ruby)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/0b0b2b0b2b0b2b0b2b0b/maintainability)](https://codeclimate.com/github/andrewblond/blake3ruby/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/0b0b2b0b2b0b2b0b2b0b/test_coverage)](https://codeclimate.com/github/andrewblond/blake3ruby/test_coverage)
6
+
7
+ This is a Ruby wrapper for the [BLAKE3](https://github.com/BLAKE3-team/BLAKE3) hash function written in Rust.
8
+
9
+ ## Requirements
10
+ Tested on Ruby 3.1 and 3.2.
11
+ You will need to have Rust installed on your system, and the `cargo` command available in your path.
12
+ See [here](https://www.rust-lang.org/tools/install) for instructions on how to install Rust.
13
+ Rust is only required to build the gem, not to use it.
14
+ Minimally, you will need Rust 1.6 or later.
15
+
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ ```ruby
22
+ gem 'blake3ruby'
23
+ ```
24
+
25
+ And then execute:
26
+
27
+ bundle install
28
+
29
+ It will take a while to build the gem, as it needs to compile the Rust code including the [BLAKE3](https://github.com/BLAKE3-team/BLAKE3) library and dependencies.
30
+
31
+ If bundler is not being used to manage dependencies, install the gem by executing:
32
+
33
+ gem install blake3ruby
34
+
35
+ ## Usage
36
+
37
+ Basic usage is similar to the `Digest` class in the Ruby standard library:
38
+ ```ruby
39
+ require 'blake3ruby'
40
+
41
+ Blake3ruby.hexdigest("Hello, world!") # => "ede5c0b10f2ec4979c69b52f61e42ff5b413519ce09be0f14d098dcfe5f6f98d"
42
+ ```
43
+
44
+ If you want to use the streaming interface, you can use the `Blake3ruby::Hasher` class:
45
+
46
+ ```ruby
47
+ require 'blake3ruby'
48
+
49
+ hasher = Blake3ruby::Hasher.new
50
+ hasher.update("Hello, ") # => #<Blake3ruby::Hasher:0x00007f9b0a0b0e00> - returns self
51
+ hasher.update("world!")
52
+ hasher.finalize # => "ede5c0b10f2ec4979c69b52f61e42ff5b413519ce09be0f14d098dcfe5f6f98d"
53
+ ```
54
+
55
+ You can also use the `Blake3ruby` module for deriving keys:
56
+
57
+ Quoting from the [BLAKE3 documentation](https://github.com/BLAKE3-team/BLAKE3#the-blake3-crate-)
58
+ ```
59
+ The derive_key mode takes a context string and some key material (not a password). The context string should be hardcoded, globally unique, and application-specific. A good default format for the context string is "[application] [commit timestamp] [purpose]"
60
+ ```
61
+
62
+ ```ruby
63
+ require 'blake3ruby'
64
+
65
+ Blake3ruby.derive_key("context", "input_key_material") # => "3eaa9796d6d3db5cd5de00d44e4888fccbf4f8c878dd6ccd0c374bded6c26405"
66
+ ```
67
+
68
+ ## Performance
69
+
70
+ The performance of this gem is comparable to the performance of the [blake3](https://github.com/BLAKE3-team/BLAKE3)
71
+ crate, which is written in Rust.
72
+
73
+ 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.
74
+ ```
75
+ user system total real
76
+ MD5: 6.376103 0.028610 6.404713 ( 6.492484)
77
+ SHA1: 5.701825 0.014154 5.715979 ( 5.721241)
78
+ SHA3-256: 6.081136 0.014625 6.095761 ( 6.102179)
79
+ SHA3-384: 6.757476 0.013765 6.771241 ( 6.778101)
80
+ SHA3-512: 6.890564 0.014625 6.905189 ( 6.909914)
81
+ RMD160: 6.196825 0.031562 6.228387 ( 6.293669)
82
+ blake3: 2.527779 0.006833 2.534612 ( 2.536978)
83
+ ```
84
+
85
+ Another benchmark was run on a 2022 MacBook Pro with a Apple M1 processor and 16 GB of RAM.
86
+ ```
87
+ user system total real
88
+ MD5: 4.080778 0.029457 4.110235 ( 4.388991)
89
+ SHA1: 3.736124 0.030763 3.766887 ( 3.991860)
90
+ SHA3-256: 3.511138 0.036125 3.547263 ( 3.664061)
91
+ SHA3-384: 4.009041 0.085845 4.094886 ( 4.094987)
92
+ SHA3-512: 4.078389 0.071463 4.149852 ( 4.149982)
93
+ RMD160: 2.965860 0.026660 2.992520 ( 3.216815)
94
+ blake3: 1.715370 0.004587 1.719957 ( 1.719995)
95
+ ```
96
+
97
+ In both cases, the `blake3ruby` gem was about 2.5 times faster than the md5, sha1, sha3-256, sha3-384, sha3-512, and rmd160 digest algorithms.
98
+
99
+ You can run the benchmarks yourself by cloning this repository and running `ruby spec/benchmark.rb`.
100
+
101
+ ## License
102
+
103
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT) and the Ruby license.
104
+
105
+
106
+ ## Development
107
+
108
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
109
+
110
+ To install this gem onto your local machine, run `bundle exec rake install`.
111
+
112
+ Pull requests are welcome.
113
+
114
+ ## How create a new pull request
115
+
116
+ 1. Fork it
117
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
118
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
119
+ 4. Push to the branch (`git push origin my-new-feature`)
120
+ 5. Create new Pull Request
121
+ 6. Wait for review
122
+
123
+ ## Contributing
124
+
125
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Nightforge/blake3ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/blake3ruby/blob/master/CODE_OF_CONDUCT.md).
126
+
127
+ ## Code of Conduct
128
+
129
+ Everyone interacting in the Blake3ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/blake3ruby/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ require "rake/extensiontask"
13
+
14
+ task build: :compile
15
+
16
+ Rake::ExtensionTask.new("blake3ruby") do |ext|
17
+ ext.lib_dir = "lib/blake3ruby"
18
+ end
19
+
20
+ task default: %i[compile spec rubocop]
@@ -0,0 +1,14 @@
1
+ [package]
2
+ name = "blake3ruby"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ authors = ["Nightforge <modo00@gmail.com>"]
6
+ publish = false
7
+
8
+ [lib]
9
+ crate-type = ["cdylib"]
10
+
11
+ [dependencies]
12
+ magnus = { version = "0.5.2" }
13
+ hex = { version = "0.4.3" }
14
+ blake3 = "1.3.3"
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "mkmf"
4
+ require "rb_sys/mkmf"
5
+
6
+ create_rust_makefile("blake3ruby/blake3ruby")
@@ -0,0 +1,53 @@
1
+ use magnus::{define_module, define_class, class, function, method, prelude::*, Error};
2
+
3
+ fn hexdigest(subject: String) -> String {
4
+ let hash = blake3::hash(subject.as_bytes());
5
+ return hash.to_string()
6
+ }
7
+
8
+ fn derive_key(context: String, key: String) -> String {
9
+ let key = blake3::derive_key(context.as_str(), key.as_bytes());
10
+ hex::encode(key)
11
+ }
12
+
13
+ #[derive(Clone)]
14
+ struct Hasher {
15
+ hasher: blake3::Hasher,
16
+ }
17
+
18
+ #[magnus::wrap(class = "Hasher")]
19
+ struct MutHasher(std::cell::RefCell<Hasher>);
20
+
21
+ impl MutHasher {
22
+ fn new() -> Self {
23
+ let blake_hasher = blake3::Hasher::new();
24
+ let hasher = Hasher { hasher: blake_hasher };
25
+ let ref_hasher = std::cell::RefCell::new(hasher);
26
+ Self(ref_hasher)
27
+ }
28
+
29
+ fn update(&self, subject: String) -> Self {
30
+ self.0.borrow_mut().hasher.update(subject.as_bytes());
31
+ return Self(self.0.clone())
32
+ }
33
+
34
+ fn finalize(&self) -> String {
35
+ let hash = self.0.borrow().hasher.finalize();
36
+ return hash.to_string()
37
+ }
38
+ }
39
+
40
+ #[magnus::init]
41
+ fn init() -> Result<(), Error> {
42
+ let blake3ruby = define_module("Blake3ruby")?;
43
+ blake3ruby.define_singleton_method("hexdigest", function!(hexdigest, 1))?;
44
+ blake3ruby.define_singleton_method("derive_key", function!(derive_key, 2))?;
45
+
46
+ let class = define_class("Hasher", class::object())?;
47
+ class.define_singleton_method("new", function!(MutHasher::new, 0))?;
48
+ class.define_method("update", method!(MutHasher::update, 1))?;
49
+ class.define_method("finalize", method!(MutHasher::finalize, 0))?;
50
+
51
+ blake3ruby.define_class("Hasher", class)?;
52
+ Ok(())
53
+ }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blake3ruby
4
+ VERSION = "0.1.0"
5
+ end
data/lib/blake3ruby.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "blake3ruby/version"
4
+ require_relative "blake3ruby/blake3ruby"
5
+
6
+ # Blake3ruby is a Ruby wrapper for the blake3 hash function.
7
+ module Blake3ruby; end
@@ -0,0 +1,4 @@
1
+ module Blake3ruby
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blake3ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nightforge
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-03-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby bindings for the blake3 hash function using the Rust implementation
14
+ email:
15
+ - modo00@gmail.com
16
+ executables: []
17
+ extensions:
18
+ - ext/blake3ruby/Cargo.toml
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".rspec"
22
+ - ".rubocop.yml"
23
+ - CODE_OF_CONDUCT.md
24
+ - Cargo.lock
25
+ - Cargo.toml
26
+ - Gemfile
27
+ - Gemfile.lock
28
+ - LICENSE.txt
29
+ - README.md
30
+ - Rakefile
31
+ - ext/blake3ruby/Cargo.toml
32
+ - ext/blake3ruby/extconf.rb
33
+ - ext/blake3ruby/src/lib.rs
34
+ - lib/blake3ruby.rb
35
+ - lib/blake3ruby/version.rb
36
+ - sig/blake3ruby.rbs
37
+ homepage: https://github.com/Nightforge/blake3ruby
38
+ licenses:
39
+ - MIT
40
+ - Ruby
41
+ metadata:
42
+ homepage_uri: https://github.com/Nightforge/blake3ruby
43
+ source_code_uri: https://github.com/Nightforge/blake3ruby
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 3.3.11
58
+ requirements: []
59
+ rubygems_version: 3.4.7
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Ruby bindings for the blake3 hash function
63
+ test_files: []