keccak 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8aceb5b5671d06e3d0db69e7818d8cbf878a6519605beb75e13216bea26d7dce
4
- data.tar.gz: 7bb0533a1e1f8f81a6b8ab21e555d0eb54fbd3c803a69a3f8a34bf90aa31bb90
3
+ metadata.gz: 4ee087f0bdede542d75edc668ec80da13eb7fa370f8b592b15a61ab8b476000b
4
+ data.tar.gz: b52445cd261c3f41f14162023b98a405a54b7a57623dbbaaefe88a7bc4909906
5
5
  SHA512:
6
- metadata.gz: e3a55a66d4b3ee22cc992ab3b5b30e584dd5c1a9781f160384f66bd7c378d4c81015fc9d9c935a81dce7c76e1fd42209e04d7dc70aa326ef98263923211cc92b
7
- data.tar.gz: e6cf1e8fbe26d116182b462f95dd9371bc9421331b4a8176dc0cd83489846396375c5d5df7dc138d1127edf5d377096899b209ca8a9930f18de831d28f9fd061
6
+ metadata.gz: df21f0f4067f4eec3b7a095a27b2890110b741dcd3d5236bbd446c17ac11956984e315b61a2e3a9cc40ffe2c531666b1d2caf63a39bd87435d7267113f9c194c
7
+ data.tar.gz: 113919c41f5a4bf475805849cffcbece79d07acb139cdc83e055c52826c88895614eea682ebe5d6a3d61a5364ba74d4c728e9f69632f8a3e2d299f841442f10b
data/COPYRIGHT CHANGED
@@ -10,5 +10,8 @@ https://github.com/teamhedge/digest-sha3-ruby
10
10
  Copyright (c) 2018-2021 Seb's; licensed under MIT License
11
11
  https://github.com/sydneyitguy/digest-sha3-ruby
12
12
 
13
+ Copyright (c) 2019-2021 Alex Kotov; licensed under MIT License
14
+ https://github.com/kotovalexarian/digest-keccak
15
+
13
16
  Copyright (c) 2021-2022 Afri Schoedon; re-licensed under Apache 2.0
14
17
  https://github.com/q9f/digest-sha3-ruby
data/README.md CHANGED
@@ -1,25 +1,31 @@
1
1
  # The Keccak (SHA-3) digest for Ruby
2
2
 
3
- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/q9f/keccak.rb/Build/main)
4
- ![GitHub top language](https://img.shields.io/github/languages/top/q9f/keccak.rb)
5
- ![GitHub release](https://img.shields.io/github/v/release/q9f/keccak.rb)
6
- ![Gem](https://img.shields.io/gem/v/keccak)
3
+ [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/q9f/keccak.rb/Build/main)](https://github.com/q9f/keccak.rb/actions)
4
+ [![GitHub top language](https://img.shields.io/github/languages/top/q9f/keccak.rb?color=black)](https://github.com/q9f/keccak.rb/pulse)
5
+ [![GitHub release](https://img.shields.io/github/v/release/q9f/keccak.rb?color=red)](https://github.com/q9f/keccak.rb/releases/latest)
6
+ [![Gem](https://img.shields.io/gem/v/keccak?color=red)](https://rubygems.org/gems/keccak)
7
+ [![License](https://img.shields.io/github/license/q9f/keccak.rb.svg?color=black)](LICENSE)
7
8
 
8
9
  This Ruby extension exposes the [Keccak](http://keccak.noekeon.org/) (SHA-3) digest C bindings in the non-final version used by Ethereum. It is based on the reference `C` implementation, version 3.2. The exposed interface is almost identical to that of the `digest` standard library.
9
10
 
10
11
  ## Installation
11
12
 
13
+ The gem is called `keccak`.
14
+
12
15
  ```bash
13
- gem install digest-keccak
16
+ bundle add keccak
17
+ gem install keccak
14
18
  ```
15
19
 
16
- **Note**: as of version `v1.1.0`, `digest-keccak` requires Ruby 2.2. `digest-keccak`version `v1.2.0` now also supports Ruby 3.0.
20
+ ```ruby
21
+ gem 'keccak', '~> 1.2'
22
+ ```
17
23
 
18
- The last version that worked on older Ruby (1.x) versions was `v1.0.2`. It can be found at the no longer maintained [digest-sha3 repository from 2015](https://github.com/phusion/digest-sha3-ruby/releases/tag/release-1.0.2).
24
+ **Note**: as of version `v1.1.0`, `digest-sha3` (historic name) requires Ruby 2.2. The new `keccak` version `v1.2.0` now also supports Ruby 3.0. The last version that worked on older Ruby (1.x) versions was `v1.0.2`. It can be found at the no longer maintained [`digest-sha3` repository from 2015](https://github.com/phusion/digest-sha3-ruby/releases/tag/release-1.0.2).
19
25
 
20
26
  ## Usage
21
27
 
22
- Keccak supports five hash lengths: 224-bit, 256-bit, 384-bit, 512-bit and variable length. Variable length is not supported by this Ruby extension. Unless the user specifies otherwise, this Ruby extension assumes 512-bit.
28
+ This gem extends the `digest/*` module by a `digest/sha3` class (historic reference, see history section below).
23
29
 
24
30
  ```ruby
25
31
  require 'digest/sha3'
@@ -44,12 +50,14 @@ digest.hexdigest # => "1597842a..."
44
50
  digest = Digest::SHA3.new(224)
45
51
  ```
46
52
 
53
+ Keccak supports five hash lengths: 224-bit, 256-bit, 384-bit, 512-bit and variable length. Variable length is not supported by this Ruby extension. Unless the user specifies otherwise, this Ruby extension assumes 512-bit.
54
+
47
55
  ## Running the test suite
48
56
 
49
57
  Run the test suite as follows:
50
58
 
51
59
  ```bash
52
- gem install test-unit
60
+ bundle install
53
61
  make test
54
62
  ```
55
63
 
@@ -63,7 +71,6 @@ A part of the test suite is automatically generated from Keccak's reference test
63
71
 
64
72
  If you are looking for the final SHA-3 gem, please use the following: https://rubygems.org/gems/sha3
65
73
 
66
-
67
74
  ## History
68
75
 
69
76
  This gem was initially developed and published as `digest-sha3`: https://github.com/phusion/digest-sha3-ruby
@@ -73,3 +80,4 @@ This gem was later patched multiple times:
73
80
  * https://github.com/teamhedge/digest-sha3-ruby (KECCAK, as `digest-sha3-patched`)
74
81
  * https://github.com/sydneyitguy/digest-sha3-ruby (KECCAK, as `digest-sha3-patched-ruby-3`)
75
82
  * https://github.com/steakknife/digest-sha3-ruby (actual SHA-3, do not use for Ethereum)
83
+ * https://github.com/kotovalexarian/digest-keccak/ (KECCAK, as `digest-keccak`)
@@ -1,7 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
1
4
  require 'mkmf'
2
5
 
3
- have_header('ruby/digest.h')
4
- have_func('rb_str_set_len')
6
+ def cflags(*args)
7
+ args.each do |str|
8
+ $CFLAGS += " #{str.shellescape} "
9
+ end
10
+ end
11
+
12
+ def have_header!(*args)
13
+ exit 1 unless have_header(*args)
14
+ end
15
+
16
+ def have_func!(header, *args)
17
+ exit 1 unless have_func(*args, header)
18
+ end
19
+
20
+ cflags '-std=c11'
21
+ cflags '-Wall'
22
+ cflags '-Wextra'
23
+ cflags '-fvisibility=hidden'
24
+
25
+ have_header! 'ruby/digest.h'
26
+ have_header! 'stdio.h'
27
+ have_header! 'string.h'
28
+
29
+ have_func! 'rb_str_set_len'
5
30
 
6
- $CFLAGS << " -fvisibility=hidden"
7
- create_makefile('digest/sha3')
31
+ create_makefile 'digest/sha3' or exit 1
data/ext/digest/sha3.c CHANGED
@@ -9,7 +9,7 @@
9
9
  #define MAX_DIGEST_SIZE 64
10
10
  #define DEFAULT_DIGEST_LEN 512
11
11
 
12
- static int sha3_init_func(hashState *ctx);
12
+ static int sha3_init_func();
13
13
  static void sha3_update_func(hashState *ctx, unsigned char *str, size_t len);
14
14
  static int sha3_finish_func(hashState *ctx, unsigned char *digest);
15
15
 
@@ -33,8 +33,8 @@ static rb_digest_metadata_t sha3 = {
33
33
  we override initialize to do custom hash size, so we don't care too much here.
34
34
  */
35
35
  static int
36
- sha3_init_func(hashState *ctx) {
37
- // Just return a 1 ' successful' we override the init function
36
+ sha3_init_func() {
37
+ // Just return a 1 'successful' we override the init function
38
38
  // so this is not necessary
39
39
  // the base class alloc calls this to initialize the algorithm
40
40
  return 1;
data/keccak.gemspec CHANGED
@@ -1,18 +1,30 @@
1
- require File.expand_path('lib/digest/sha3/version')
1
+ # frozen_string_literal: true
2
2
 
3
- Gem::Specification.new do |s|
4
- s.name = "keccak"
5
- s.version = Digest::SHA3::Version::STRING
6
- s.summary = "The Keccak (SHA-3) hash used by Ethereum."
7
- s.email = "ruby@q9f.cc"
8
- s.homepage = "https://github.com/q9f/keccak.rb"
9
- s.description = "The Keccak (SHA-3) hash use by Ethereum. This does not implement the final FIPS202 standard, today known as SHA3 but rather an early version, commonly referred to as Keccak."
10
- s.authors = ["Afri Schoedon", "Chris Metcalfe", "Hongli Lai (Phusion)", "Keccak authors"]
11
- s.extensions << "ext/digest/extconf.rb"
12
- s.required_ruby_version = ">= 2.2"
13
- s.license = "Apache-2.0"
3
+ lib = File.expand_path('lib', __dir__).freeze
4
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib
14
5
 
15
- s.files = Dir[
6
+ require 'digest/sha3/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "keccak"
10
+ spec.version = Digest::SHA3::VERSION
11
+ spec.summary = "The Keccak (SHA-3) hash used by Ethereum."
12
+ spec.description = "The Keccak (SHA-3) hash use by Ethereum. This does not implement the final FIPS202 standard, today known as SHA3 but rather an early version, commonly referred to as Keccak."
13
+ spec.homepage = "https://github.com/q9f/keccak.rb"
14
+ spec.authors = ["Afri Schoedon", "Alex Kotov", "Chris Metcalfe", "Hongli Lai (Phusion)", "Keccak authors"]
15
+ spec.email = "%w[ruby@q9f.cc]"
16
+ spec.extensions << "ext/digest/extconf.rb"
17
+ spec.platform = Gem::Platform::RUBY
18
+ spec.required_ruby_version = ">= 2.2", "< 4.0"
19
+ spec.license = "Apache-2.0"
20
+ spec.metadata = {
21
+ 'homepage_uri' => 'https://github.com/q9f/keccak.rb',
22
+ 'source_code_uri' => 'https://github.com/q9f/keccak.rb',
23
+ 'bug_tracker_uri' =>
24
+ 'https://github.com/q9f/keccak.rb/issues',
25
+ }.freeze
26
+ spec.require_paths = ['lib']
27
+ spec.files = Dir[
16
28
  "README.md",
17
29
  "COPYRIGHT",
18
30
  "LICENSE",
@@ -21,4 +33,7 @@ Gem::Specification.new do |s|
21
33
  "ext/**/*.{c,h,rb}",
22
34
  "lib/**/*"
23
35
  ]
36
+ spec.test_files = spec.files.grep %r{^(test|spec|features)/}
37
+ spec.add_development_dependency 'bundler', '~> 2.2'
38
+ spec.add_development_dependency 'test-unit', '~> 3.4'
24
39
  end
@@ -1,7 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Digest
2
4
  class SHA3
3
- module Version
4
- STRING = "1.2.0"
5
- end
5
+ VERSION = '1.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,22 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keccak
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Afri Schoedon
8
+ - Alex Kotov
8
9
  - Chris Metcalfe
9
10
  - Hongli Lai (Phusion)
10
11
  - Keccak authors
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2021-09-30 00:00:00.000000000 Z
15
- dependencies: []
15
+ date: 2021-10-02 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: bundler
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "~>"
22
+ - !ruby/object:Gem::Version
23
+ version: '2.2'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '2.2'
31
+ - !ruby/object:Gem::Dependency
32
+ name: test-unit
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - "~>"
36
+ - !ruby/object:Gem::Version
37
+ version: '3.4'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - "~>"
43
+ - !ruby/object:Gem::Version
44
+ version: '3.4'
16
45
  description: The Keccak (SHA-3) hash use by Ethereum. This does not implement the
17
46
  final FIPS202 standard, today known as SHA3 but rather an early version, commonly
18
47
  referred to as Keccak.
19
- email: ruby@q9f.cc
48
+ email: "%w[ruby@q9f.cc]"
20
49
  executables: []
21
50
  extensions:
22
51
  - ext/digest/extconf.rb
@@ -43,7 +72,10 @@ files:
43
72
  homepage: https://github.com/q9f/keccak.rb
44
73
  licenses:
45
74
  - Apache-2.0
46
- metadata: {}
75
+ metadata:
76
+ homepage_uri: https://github.com/q9f/keccak.rb
77
+ source_code_uri: https://github.com/q9f/keccak.rb
78
+ bug_tracker_uri: https://github.com/q9f/keccak.rb/issues
47
79
  post_install_message:
48
80
  rdoc_options: []
49
81
  require_paths:
@@ -53,13 +85,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
85
  - - ">="
54
86
  - !ruby/object:Gem::Version
55
87
  version: '2.2'
88
+ - - "<"
89
+ - !ruby/object:Gem::Version
90
+ version: '4.0'
56
91
  required_rubygems_version: !ruby/object:Gem::Requirement
57
92
  requirements:
58
93
  - - ">="
59
94
  - !ruby/object:Gem::Version
60
95
  version: '0'
61
96
  requirements: []
62
- rubygems_version: 3.2.27
97
+ rubygems_version: 3.2.28
63
98
  signing_key:
64
99
  specification_version: 4
65
100
  summary: The Keccak (SHA-3) hash used by Ethereum.