digest-blake3 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dd017f37b8a918a01192a1bc37736f0e3c5f4304a168e9dc86c0b248e9df938a
4
+ data.tar.gz: 99e2195b8415c0165e8bda5118c32b6136cb92b7fc0372b5539edbac045b4792
5
+ SHA512:
6
+ metadata.gz: dea6e7b5ca985d34bd630c75a432ebee442908079bd5099cd667e83da4db30bb5169c07cf216e7c1e84c8d4fe5124e8ace7960455d179aa7c2450b943f284b27
7
+ data.tar.gz: bcfa94c0b78ce490aa0149412dd56f660bd6577469c13618f46ae8132d9a12c7cb2c7afb8329db8810adf6455c1e1554b51c918d94e14fe1a4fa6065ca37b09a
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.o
10
+ *.bundle
11
+ *.so
12
+ *.a
13
+ ext/digest/blake3/Makefile
14
+ ext/digest/blake3/mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ dist: bionic
6
+ rvm:
7
+ - 2.6
8
+ before_install: gem install bundler -v 1.17.3
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in digest-blake3.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,22 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ digest-blake3 (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ minitest (5.14.0)
10
+ rake (13.0.1)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler
17
+ digest-blake3!
18
+ minitest (~> 5.0)
19
+ rake
20
+
21
+ BUNDLED WITH
22
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Will Bryant
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,65 @@
1
+ # Digest::BLAKE3
2
+
3
+ BLAKE3 for Ruby. Uses a bundled copy of the C implementation from [BLAKE3-team](https://github.com/BLAKE3-team/BLAKE3/tree/master/c) to minimize dependencies.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'digest-blake3'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install digest-blake3
20
+
21
+ ## Usage
22
+
23
+ `Digest::BLAKE3` is implemented using the standard library's `Digest` wrapper, which gives you a broad API:
24
+
25
+ ```ruby
26
+ require 'digest/blake3'
27
+
28
+ # Compute a complete digest
29
+ Digest::BLAKE3.digest("input data") # returns binary data in a string
30
+
31
+ blake3 = Digest::BLAKE3.new
32
+ blake3.digest "input data"
33
+
34
+ # Other encoding formats
35
+ Digest::BLAKE3.hexdigest("input data")
36
+ Digest::BLAKE3.base64digest("input data")
37
+
38
+ # Compute digest by chunks
39
+ blake3 = Digest::BLAKE3.new
40
+ blake3.update("input")
41
+ blake3 << " data"
42
+ blake3.hexdigest
43
+
44
+ # Compute digest for a file
45
+ blake3 = Digest::BLAKE3.file 'testfile'
46
+ blake3.hexdigest
47
+ ```
48
+
49
+ ## Alternatives
50
+
51
+ * [blake3 gem](https://github.com/Yamaguchi/blake3rb) by @Yamaguchi uses the original Rust implementation of BLAKE3. This supports even greater speed through multi-threaded hashing, but requires Rust and Cargo on the systems you install the gem on.
52
+
53
+ ## Development
54
+
55
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake compile` to compile the library and `bundle exec rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
56
+
57
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
58
+
59
+ ## Contributing
60
+
61
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/digest-blake3.
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :compile do
11
+ puts "Compiling ext/digest/blake3/blake3.o"
12
+ system('cd ext/digest/blake3 && ruby extconf.rb && make')
13
+ end
14
+
15
+ task :default => [:compile, :test]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "digest/blake3"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,29 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "digest/blake3/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "digest-blake3"
7
+ spec.version = Digest::BLAKE3::VERSION
8
+ spec.authors = ["Will Bryant"]
9
+ spec.email = ["will.bryant@gmail.com"]
10
+
11
+ spec.summary = %q{BLAKE3 for Ruby}
12
+ spec.description = %q{Self-contained C implementation of BLAKE3.}
13
+ spec.homepage = "https://github.com/willbryant/digest-blake3"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib", "ext"]
24
+ spec.extensions = %w[ext/digest/blake3/extconf.rb]
25
+
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "minitest", "~> 5.0"
29
+ end