keccak 1.2.0 → 1.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/COPYRIGHT +3 -0
- data/README.md +18 -10
- data/ext/digest/extconf.rb +28 -4
- data/ext/digest/sha3.c +3 -3
- data/keccak.gemspec +28 -13
- data/lib/digest/sha3/version.rb +3 -3
- metadata +41 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ee087f0bdede542d75edc668ec80da13eb7fa370f8b592b15a61ab8b476000b
|
4
|
+
data.tar.gz: b52445cd261c3f41f14162023b98a405a54b7a57623dbbaaefe88a7bc4909906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-

|
4
|
-

|
5
|
-

|
6
|
-

|
3
|
+
[](https://github.com/q9f/keccak.rb/actions)
|
4
|
+
[](https://github.com/q9f/keccak.rb/pulse)
|
5
|
+
[](https://github.com/q9f/keccak.rb/releases/latest)
|
6
|
+
[](https://rubygems.org/gems/keccak)
|
7
|
+
[](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
|
-
|
16
|
+
bundle add keccak
|
17
|
+
gem install keccak
|
14
18
|
```
|
15
19
|
|
16
|
-
|
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
|
-
|
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
|
-
|
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`)
|
data/ext/digest/extconf.rb
CHANGED
@@ -1,7 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
1
4
|
require 'mkmf'
|
2
5
|
|
3
|
-
|
4
|
-
|
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
|
-
|
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(
|
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(
|
37
|
-
// Just return a 1 '
|
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
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
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
|
-
|
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
|
data/lib/digest/sha3/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|