blake3-rb 1.5.4.1-aarch64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +141 -0
- data/lib/blake3-rb.rb +3 -0
- data/lib/digest/blake3/3.1/blake3_ext.so +0 -0
- data/lib/digest/blake3/3.2/blake3_ext.so +0 -0
- data/lib/digest/blake3/3.3/blake3_ext.so +0 -0
- data/lib/digest/blake3.rb +16 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 296598edcd3738f29233d1ded62593331bb415ef8e3b89d3b088ee0f7f701d49
|
4
|
+
data.tar.gz: 5c59bac0cc23d0f3c6b42d3c6fa8ffd0f96a3d0a801de47b6a4e7d8d6fb70350
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c7bce5eaf415b46b27a5f5b64288ca67370fccb270c92438ccbb5f02ff0f8d471c38c0de9e6d4120ced0d42e3735b9d74684b3aa18144adc361a3221144d042
|
7
|
+
data.tar.gz: b2c1e4be09c3df6e1939dfe8ac67909b0e6f4fb082eeb19909c99cf19814af586591f17cdf9fab35d67561f2282251e80a42565e4bba80f82eabf0a14833498f
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Shopify, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
# `blake3-rb`
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/blake3-rb.svg)](https://badge.fury.io/rb/blake3-rb)
|
4
|
+
![Build Status](https://github.com/Shopify/blake3-ruby/workflows/CI/badge.svg)
|
5
|
+
|
6
|
+
Blake3 is a Ruby gem that provides a simple and efficient way to compute the Blake3 cryptographic hash function. This gem is designed to be easy to use and integrate into your Ruby projects using the Ruby [`digest` framework](https://github.com/ruby/digest).
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem "blake3-rb"
|
14
|
+
```
|
15
|
+
|
16
|
+
We provide pre-built binaries most common platforms. This is the preferred way to install this gem since it will be faster and more reliable than compiling from source. Make sure Bundler is configured to use the pre-built binaries by running:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
bundle lock --add-platform x86_64-linux
|
20
|
+
bundle install # resolve dependencies for platform-specific gems
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Here's a simple usage example:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require "digest/blake3"
|
29
|
+
|
30
|
+
result = Digest::Blake3.hexdigest("your data here")
|
31
|
+
```
|
32
|
+
|
33
|
+
If you need to stream data:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require "digest/blake3"
|
37
|
+
|
38
|
+
hasher = Digest::Blake3.new
|
39
|
+
hasher.update("your data here")
|
40
|
+
result = hasher.hexdigest
|
41
|
+
```
|
42
|
+
|
43
|
+
Or use the `<<` operator:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require "digest/blake3"
|
47
|
+
|
48
|
+
hasher = Digest::Blake3.new
|
49
|
+
hasher << "part1" << "part2"
|
50
|
+
result = hasher.hexdigest
|
51
|
+
```
|
52
|
+
|
53
|
+
### Base64 Digest
|
54
|
+
|
55
|
+
You can compute the Base64 digest of your data:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
require "digest/blake3"
|
59
|
+
|
60
|
+
result = Digest::Blake3.base64digest("your data here")
|
61
|
+
```
|
62
|
+
|
63
|
+
### Equality
|
64
|
+
|
65
|
+
You can compare two digests for equality:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
require "digest/blake3"
|
69
|
+
|
70
|
+
digest_one = Digest::Blake3.new
|
71
|
+
digest_two = Digest::Blake3.new
|
72
|
+
|
73
|
+
digest_one.update("your data here")
|
74
|
+
digest_two.update("your data here")
|
75
|
+
|
76
|
+
if digest_one == digest_two
|
77
|
+
puts "Digests are equal"
|
78
|
+
else
|
79
|
+
puts "Digests are not equal"
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
You can compute the hash of a file:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
require "digest/blake3"
|
87
|
+
|
88
|
+
result = Digest::Blake3.file("path/to/your/file")
|
89
|
+
```
|
90
|
+
|
91
|
+
## Benchmarks
|
92
|
+
|
93
|
+
Here are some benchmarks comparing this gem with other digests on `x86_64-linux`:
|
94
|
+
|
95
|
+
```bash
|
96
|
+
$ ruby bench/string.rb
|
97
|
+
...
|
98
|
+
Warming up --------------------------------------
|
99
|
+
Digest::SHA1 61.000 i/100ms
|
100
|
+
Digest::SHA256 21.000 i/100ms
|
101
|
+
Digest::MD5 58.000 i/100ms
|
102
|
+
Digest::Blake3 560.000 i/100ms
|
103
|
+
Calculating -------------------------------------
|
104
|
+
Digest::SHA1 612.174 (± 0.3%) i/s - 3.111k in 5.081922s
|
105
|
+
Digest::SHA256 215.281 (± 0.0%) i/s - 1.092k in 5.072453s
|
106
|
+
Digest::MD5 586.009 (± 0.3%) i/s - 2.958k in 5.047759s
|
107
|
+
Digest::Blake3 5.698k (± 0.6%) i/s - 28.560k in 5.012308s
|
108
|
+
|
109
|
+
Comparison:
|
110
|
+
Digest::Blake3: 5698.2 i/s
|
111
|
+
Digest::SHA1: 612.2 i/s - 9.31x slower
|
112
|
+
Digest::MD5: 586.0 i/s - 9.72x slower
|
113
|
+
Digest::SHA256: 215.3 i/s - 26.47x slower
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
## Testing
|
118
|
+
|
119
|
+
First, make sure your development environment is setup:
|
120
|
+
|
121
|
+
```bash
|
122
|
+
$ bin/setup
|
123
|
+
```
|
124
|
+
|
125
|
+
To run the tests, execute:
|
126
|
+
|
127
|
+
```bash
|
128
|
+
$ bundle exec rake test
|
129
|
+
```
|
130
|
+
|
131
|
+
## Contributing
|
132
|
+
|
133
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/blake3-ruby. 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/Shopify/blake3-ruby/blob/main/CODE_OF_CONDUCT.md).
|
134
|
+
|
135
|
+
## License
|
136
|
+
|
137
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
138
|
+
|
139
|
+
## Code of Conduct
|
140
|
+
|
141
|
+
Everyone interacting in the Blake3 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Shopify/blake3-ruby/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/blake3-rb.rb
ADDED
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "digest"
|
4
|
+
|
5
|
+
module Digest
|
6
|
+
class Blake3 < Digest::Base
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# Tries to require the precompiled extension for the given Ruby version first
|
11
|
+
begin
|
12
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
13
|
+
require "digest/blake3/#{Regexp.last_match(1)}/blake3_ext"
|
14
|
+
rescue LoadError
|
15
|
+
require_relative "blake3/blake3_ext"
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blake3-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.4.1
|
5
|
+
platform: aarch64-linux-musl
|
6
|
+
authors:
|
7
|
+
- Ian Ker-Seymer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Provides native bindings to the Blake3 hash function for Ruby.
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- LICENSE.txt
|
20
|
+
- README.md
|
21
|
+
- lib/blake3-rb.rb
|
22
|
+
- lib/digest/blake3.rb
|
23
|
+
- lib/digest/blake3/3.1/blake3_ext.so
|
24
|
+
- lib/digest/blake3/3.2/blake3_ext.so
|
25
|
+
- lib/digest/blake3/3.3/blake3_ext.so
|
26
|
+
homepage: https://github.com/Shopify/blake3-ruby
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata:
|
30
|
+
allowed_push_host: https://rubygems.org
|
31
|
+
homepage_uri: https://github.com/Shopify/blake3-ruby
|
32
|
+
source_code_uri: https://github.com/Shopify/blake3-ruby
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.1'
|
42
|
+
- - "<"
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 3.4.dev
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.3.22
|
50
|
+
requirements: []
|
51
|
+
rubygems_version: 3.4.4
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: Blake3 hash function bindings for Ruby.
|
55
|
+
test_files: []
|