sha3 1.0.5 → 2.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.clang-format +54 -0
- data/.document +3 -3
- data/.rdoc_options +11 -0
- data/.rspec +2 -2
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +23 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +185 -65
- data/Rakefile +12 -4
- data/certs/io+sha3@jsg.io.pem +26 -0
- data/doc/sha3.rb +83 -0
- data/ext/sha3/config.h +2 -2
- data/ext/sha3/digest.c +726 -169
- data/ext/sha3/digest.h +6 -35
- data/ext/sha3/extconf.rb +42 -38
- data/ext/sha3/kmac.c +504 -0
- data/ext/sha3/kmac.h +14 -0
- data/ext/sha3/lib/high/Keccak/KeccakDuplex.c +81 -0
- data/ext/sha3/lib/high/Keccak/KeccakDuplex.h +73 -0
- data/ext/sha3/lib/high/Keccak/KeccakDuplex.inc +201 -0
- data/ext/sha3/lib/high/Keccak/KeccakSponge.c +2 -18
- data/ext/sha3/lib/high/Keccak/KeccakSponge.h +4 -10
- data/ext/sha3/lib/high/Keccak/KeccakSponge.inc +27 -31
- data/ext/sha3/lib/high/Keccak/PRG/KeccakPRG.c +61 -0
- data/ext/sha3/lib/high/Keccak/PRG/KeccakPRG.h +67 -0
- data/ext/sha3/lib/high/Keccak/PRG/KeccakPRG.inc +128 -0
- data/ext/sha3/lib/high/Keccak/SP800-185/SP800-185.c +93 -0
- data/ext/sha3/lib/high/Keccak/SP800-185/SP800-185.h +599 -0
- data/ext/sha3/lib/high/Keccak/SP800-185/SP800-185.inc +573 -0
- data/ext/sha3/lib/high/common/Phases.h +25 -0
- data/ext/sha3/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros +19 -9
- data/ext/sha3/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +18 -12
- data/ext/sha3/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +28 -36
- data/ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +18 -12
- data/ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +28 -59
- data/ext/sha3/lib/low/common/PlSnP-Fallback.inc +291 -0
- data/ext/sha3/lib/low/common/SnP-Relaned.h +145 -0
- data/ext/sha3/sha3.c +28 -59
- data/ext/sha3/sha3.h +4 -13
- data/lib/constants.rb +5 -0
- data/lib/sha3.rb +25 -24
- data.tar.gz.sig +0 -0
- metadata +61 -127
- metadata.gz.sig +0 -0
- data/.yardopts +0 -1
- data/ChangeLog.rdoc +0 -27
- data/certs/johanns.pem +0 -25
- data/lib/sha3/doc.rb +0 -121
- data/lib/sha3/version.rb +0 -9
- data/sha3.gemspec +0 -54
- data/tests.sh +0 -29
metadata
CHANGED
@@ -1,127 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sha3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johanns Gregorian
|
8
|
-
|
9
|
-
bindir: exe
|
8
|
+
bindir: bin
|
10
9
|
cert_chain:
|
11
10
|
- |
|
12
11
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
+
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
12
|
+
MIIEYDCCAsigAwIBAgIBATANBgkqhkiG9w0BAQsFADA7MRAwDgYDVQQDDAdpb19z
|
13
|
+
aGEzMRMwEQYKCZImiZPyLGQBGRYDanNnMRIwEAYKCZImiZPyLGQBGR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C8lYjC2pN/Fh+FlgrJkqAoJ0wBlh3+wkhYPhSehkUy/2HaUYYTd1Zv4Odw+C/Q
|
29
|
+
rQnN5+nIv+gMrLwoBXH9sFjAp/iYKd4cDz5aUVNrPqibj8zivcSqFJ9lsyOvIZO6
|
30
|
+
tajU2HVxXOkpTtLzMgPEGdwlFEd2tB7VCGFbrTskxrpv243b0HdpeEVh2e9dNkl4
|
31
|
+
XobOvUPXHzFTDucYe8jpCn7e7Cj43PpTZFnxIRJnO8cVpX6n7UG8+JgBSqvwuv5C
|
32
|
+
YwFBqP6G2+0e0EdIIMdbCDBTmJbFyBr6y4pzED/FvEFzhAmCKOcZ6RJ8H7hkX5rh
|
33
|
+
+L4c9pHTemc2sQl7kH+mrntu7pt6D4EM4FD5eyWujQN1ME7xvLIFm5SczqCzFDfe
|
34
|
+
UjZtrp/rHLfHln46RvB+a1NlMRWxtJ7mQc/CMEbT+cpHlzuYa9qGakA4TmMpK10h
|
35
|
+
uYUv/V6CD4iTEMby0dopwHt5NqE=
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
38
|
-
dependencies:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- - "~>"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '13.0'
|
46
|
-
type: :development
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '13.0'
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: rake-compiler
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '1.2'
|
60
|
-
type: :development
|
61
|
-
prerelease: false
|
62
|
-
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
requirements:
|
64
|
-
- - "~>"
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '1.2'
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: rspec
|
69
|
-
requirement: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - "~>"
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: '3.11'
|
74
|
-
type: :development
|
75
|
-
prerelease: false
|
76
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - "~>"
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '3.11'
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: rubocop
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - "~>"
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '1.37'
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - "~>"
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '1.37'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: rubocop-rake
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
requirements:
|
99
|
-
- - "~>"
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0.6'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '0.6'
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: rubocop-rspec
|
111
|
-
requirement: !ruby/object:Gem::Requirement
|
112
|
-
requirements:
|
113
|
-
- - "~>"
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: '2.14'
|
116
|
-
type: :development
|
117
|
-
prerelease: false
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - "~>"
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '2.14'
|
123
|
-
description: A XKCP based native (C) binding to SHA3 (FIPS 202) cryptographic hashing
|
124
|
-
algorithm.
|
37
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
38
|
+
dependencies: []
|
39
|
+
description: |
|
40
|
+
A high-performance native binding to the SHA3 (FIPS 202) cryptographic hashing algorithms, based on the XKCP - eXtended Keccak Code Package.
|
41
|
+
This gem provides support for the standard SHA-3 fixed-length functions (224, 256, 384, and 512 bits),
|
42
|
+
as well as the SHAKE128/SHAKE256 extendable-output functions (XOFs) and KMAC (Keccak Message Authentication Code) as specified in NIST SP 800-185.'
|
125
43
|
email:
|
126
44
|
- io+sha3@jsg.io
|
127
45
|
executables: []
|
@@ -129,27 +47,41 @@ extensions:
|
|
129
47
|
- ext/sha3/extconf.rb
|
130
48
|
extra_rdoc_files: []
|
131
49
|
files:
|
50
|
+
- ".clang-format"
|
132
51
|
- ".document"
|
52
|
+
- ".rdoc_options"
|
133
53
|
- ".rspec"
|
134
54
|
- ".rubocop.yml"
|
135
|
-
-
|
136
|
-
- ChangeLog.rdoc
|
55
|
+
- CHANGELOG.md
|
137
56
|
- Gemfile
|
138
57
|
- LICENSE.txt
|
139
58
|
- README.md
|
140
59
|
- Rakefile
|
141
|
-
- certs/
|
60
|
+
- certs/io+sha3@jsg.io.pem
|
61
|
+
- doc/sha3.rb
|
142
62
|
- ext/sha3/config.h
|
143
63
|
- ext/sha3/digest.c
|
144
64
|
- ext/sha3/digest.h
|
145
65
|
- ext/sha3/extconf.rb
|
66
|
+
- ext/sha3/kmac.c
|
67
|
+
- ext/sha3/kmac.h
|
146
68
|
- ext/sha3/lib/common/align.h
|
147
69
|
- ext/sha3/lib/common/brg_endian.h
|
148
70
|
- ext/sha3/lib/high/Keccak/FIPS202/KeccakHash.c
|
149
71
|
- ext/sha3/lib/high/Keccak/FIPS202/KeccakHash.h
|
72
|
+
- ext/sha3/lib/high/Keccak/KeccakDuplex.c
|
73
|
+
- ext/sha3/lib/high/Keccak/KeccakDuplex.h
|
74
|
+
- ext/sha3/lib/high/Keccak/KeccakDuplex.inc
|
150
75
|
- ext/sha3/lib/high/Keccak/KeccakSponge.c
|
151
76
|
- ext/sha3/lib/high/Keccak/KeccakSponge.h
|
152
77
|
- ext/sha3/lib/high/Keccak/KeccakSponge.inc
|
78
|
+
- ext/sha3/lib/high/Keccak/PRG/KeccakPRG.c
|
79
|
+
- ext/sha3/lib/high/Keccak/PRG/KeccakPRG.h
|
80
|
+
- ext/sha3/lib/high/Keccak/PRG/KeccakPRG.inc
|
81
|
+
- ext/sha3/lib/high/Keccak/SP800-185/SP800-185.c
|
82
|
+
- ext/sha3/lib/high/Keccak/SP800-185/SP800-185.h
|
83
|
+
- ext/sha3/lib/high/Keccak/SP800-185/SP800-185.inc
|
84
|
+
- ext/sha3/lib/high/common/Phases.h
|
153
85
|
- ext/sha3/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros
|
154
86
|
- ext/sha3/lib/low/KeccakP-1600/common/KeccakP-1600-unrolling.macros
|
155
87
|
- ext/sha3/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h
|
@@ -158,22 +90,24 @@ files:
|
|
158
90
|
- ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h
|
159
91
|
- ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c
|
160
92
|
- ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h
|
93
|
+
- ext/sha3/lib/low/common/PlSnP-Fallback.inc
|
94
|
+
- ext/sha3/lib/low/common/SnP-Relaned.h
|
161
95
|
- ext/sha3/sha3.c
|
162
96
|
- ext/sha3/sha3.h
|
97
|
+
- lib/constants.rb
|
163
98
|
- lib/sha3.rb
|
164
|
-
- lib/sha3/doc.rb
|
165
|
-
- lib/sha3/version.rb
|
166
|
-
- sha3.gemspec
|
167
|
-
- tests.sh
|
168
99
|
homepage: https://github.com/johanns/sha3
|
169
100
|
licenses:
|
170
101
|
- MIT
|
171
102
|
metadata:
|
172
103
|
changelog_uri: https://github.com/johanns/sha3/CHANGELOG.md
|
173
104
|
homepage_uri: https://github.com/johanns/sha3
|
174
|
-
|
105
|
+
documentation_uri: https://docs.jsg.io/sha3/index.html
|
175
106
|
rubygems_mfa_required: 'true'
|
176
|
-
post_install_message:
|
107
|
+
post_install_message: |2
|
108
|
+
[NOTICE] SHA3 version 2.0 introduces breaking changes to the API.
|
109
|
+
Please review the changelog and ensure compatibility with your application.
|
110
|
+
If you need the previous behavior, lock your Gemfile to version '~> 1.0'."
|
177
111
|
rdoc_options: []
|
178
112
|
require_paths:
|
179
113
|
- lib
|
@@ -181,15 +115,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
115
|
requirements:
|
182
116
|
- - ">="
|
183
117
|
- !ruby/object:Gem::Version
|
184
|
-
version: 2.
|
118
|
+
version: 2.7.0
|
185
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
120
|
requirements:
|
187
121
|
- - ">="
|
188
122
|
- !ruby/object:Gem::Version
|
189
123
|
version: '0'
|
190
124
|
requirements: []
|
191
|
-
rubygems_version: 3.
|
192
|
-
signing_key:
|
125
|
+
rubygems_version: 3.6.2
|
193
126
|
specification_version: 4
|
194
|
-
summary: SHA3 (FIPS 202) cryptographic hashing
|
127
|
+
summary: 'SHA3 (FIPS 202) cryptographic hashing algorithms: SHA3-224/256/384/512,
|
128
|
+
SHAKE128/256, and KMAC'
|
195
129
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
lib/**/doc.rb lib/**/version.rb --markup rdoc --title "sha3 Documentation" --protected
|
data/ChangeLog.rdoc
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
=== 0.1.0 / 2012-10-04
|
2
|
-
|
3
|
-
* Initial release:
|
4
|
-
|
5
|
-
=== 0.1.1 / 2012-10-07
|
6
|
-
|
7
|
-
* Replaced Keccak reference code with optimized (~10x faster)
|
8
|
-
|
9
|
-
=== 0.2.0 / 2012-11-1
|
10
|
-
|
11
|
-
* SHA3::Digest: A proper ::Digest subclass.
|
12
|
-
|
13
|
-
=== 0.2.2 / 2012-12-14
|
14
|
-
|
15
|
-
* Added sub-class for each SHA3 supported bit-lengths (example: SHA3::Digest::SHA256). Minor bug fix.
|
16
|
-
|
17
|
-
=== 0.2.3 / 2013-1-28
|
18
|
-
|
19
|
-
* Added documentation file (decoupled form C source); refactored C source.
|
20
|
-
|
21
|
-
=== 0.2.4 / 2013-5-20
|
22
|
-
|
23
|
-
* Fixed instance copy validation code (YANKED)
|
24
|
-
|
25
|
-
=== 0.2.5 / 2013-5-21
|
26
|
-
|
27
|
-
* Fixed the fix to instance copy validation code.
|
data/certs/johanns.pem
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIETDCCArSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA2MQswCQYDVQQDDAJpbzET
|
3
|
-
MBEGCgmSJomT8ixkARkWA2pzZzESMBAGCgmSJomT8ixkARkWAmlvMB4XDTIyMTAy
|
4
|
-
NDA2MzcxMVoXDTIzMTAyNDA2MzcxMVowNjELMAkGA1UEAwwCaW8xEzARBgoJkiaJ
|
5
|
-
k/IsZAEZFgNqc2cxEjAQBgoJkiaJk/IsZAEZFgJpbzCCAaIwDQYJKoZIhvcNAQEB
|
6
|
-
BQADggGPADCCAYoCggGBALQTl5BGmtYGvljWwOTxe2Uul7RoBcSOwFUh03qUvHJf
|
7
|
-
1LmWr6y1j97ogl/VffBXpbtTU4adZa+qTxfMs7GpfKDjikSIieZ7SrMNB68zCH0e
|
8
|
-
undHx+bMutN7919rviHfGyaXlQK4SsuWUl4AOlgT69VPQp6dOBYY9T78jbr/ZcG6
|
9
|
-
+mDlRpNfPVg5i67euvpR5dO9SpO1HNoHmzx5L4wYNr9QykIft1oA+Ne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ku7g0TCR1/Y1V3ODgkTLqhw+kQZmlbQEVzcwxGk9eL8z
|
25
|
-
-----END CERTIFICATE-----
|
data/lib/sha3/doc.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'digest'
|
4
|
-
|
5
|
-
module SHA3
|
6
|
-
# A sub-class of (MRI Ruby based) Digest::Class, it implements SHA3 (Keccak) digest algorithm.
|
7
|
-
#
|
8
|
-
# @note SHA3::Digest class provides a four sub-classes for the available hash bit lengths (types).
|
9
|
-
# You can instantiate a new instance of Digest sub-class for a given type using the following sub-classes:
|
10
|
-
#
|
11
|
-
# SHA3::Digest::SHA224([data])
|
12
|
-
# SHA3::Digest::SHA256([data])
|
13
|
-
# SHA3::Digest::SHA384([data])
|
14
|
-
# SHA3::Digest::SHA512([data])
|
15
|
-
#
|
16
|
-
# The [data] parameter is optional.
|
17
|
-
class Digest < Digest::Class
|
18
|
-
# Creates a Digest instance based on given hash bit length (type).
|
19
|
-
#
|
20
|
-
# @param type [Number, Symbol] optional parameter used to set hash bit length (type).
|
21
|
-
# Valid options are:
|
22
|
-
#
|
23
|
-
# Number: 224, 256, 384, or 512
|
24
|
-
# Symobols: :sha224, :sha256, :sha384, or :sha512
|
25
|
-
#
|
26
|
-
# Default value: 256 (bits)
|
27
|
-
# @param data [String] optional parameter used to update initial instance state.
|
28
|
-
# #
|
29
|
-
# @return [Digest] self
|
30
|
-
#
|
31
|
-
# @example
|
32
|
-
# digest = SHA3::Digest.new # => Defaults to 256 bits
|
33
|
-
# digest = SHA3::Digest.new(224) # => Initialize a new 224 bit digest instance
|
34
|
-
# digest = SHA3::Digest::SHA224 # => An alternate method for creating a digest class with 224 bit hash bit length
|
35
|
-
def initialize(type, data)
|
36
|
-
# See function: c_digest_init(...) in ext/sha3/_digest.c
|
37
|
-
end
|
38
|
-
|
39
|
-
# Updates, and recalculates Message Digest (state) with given data. If a message digest
|
40
|
-
# is to be computed from several subsequent sources, then each may be passed individually
|
41
|
-
# to the Digest instance.
|
42
|
-
#
|
43
|
-
# @param data [String] data to compute
|
44
|
-
#
|
45
|
-
# @return [Digest] self
|
46
|
-
#
|
47
|
-
# @example
|
48
|
-
# digest = SHA3::Digest::SHA256.new
|
49
|
-
# digest.update('hash me')
|
50
|
-
# digest.update('me too')
|
51
|
-
def update(data)
|
52
|
-
# See function: c_digest_update(...) in ext/sha3/_digest.c
|
53
|
-
end
|
54
|
-
|
55
|
-
# Alias for update method
|
56
|
-
alias << :update
|
57
|
-
|
58
|
-
# Resets the Digest object to initial state, abandoning computed data.
|
59
|
-
#
|
60
|
-
# @return [Digest] self
|
61
|
-
def reset
|
62
|
-
# See function: c_digest_reset(...) in ext/sha3/_digest.c
|
63
|
-
end
|
64
|
-
|
65
|
-
# Returns message digest length in bytes.
|
66
|
-
#
|
67
|
-
# @return [Number] message length in bytes.
|
68
|
-
#
|
69
|
-
# @example
|
70
|
-
# digest = SHA3::Digest::SHA256.new
|
71
|
-
# digest.length # Result => 32 (or 256 bits)
|
72
|
-
def length
|
73
|
-
# See function: c_digest_length(...) in ext/sha3/_digest.c
|
74
|
-
end
|
75
|
-
|
76
|
-
# Returns digest block length in bytes.
|
77
|
-
#
|
78
|
-
# @return [Number] digest block length in bytes.
|
79
|
-
#
|
80
|
-
# @example
|
81
|
-
# digest = SHA3::Digest::SHA384.new
|
82
|
-
# digest.block_length # Result => 104
|
83
|
-
def block_length
|
84
|
-
# See function: c_digest_block_length(...) in ext/sha3/_digest.c
|
85
|
-
end
|
86
|
-
|
87
|
-
# Returns name of initialized digest
|
88
|
-
#
|
89
|
-
# @return [String] name
|
90
|
-
def name
|
91
|
-
# See function: c_digest_name(...) in ext/sha3/_digest.c
|
92
|
-
end
|
93
|
-
|
94
|
-
# Returns computed hash value for given hash type, and data in hex (string).
|
95
|
-
#
|
96
|
-
# @param type [Number, Symbol] See {#initialize} for valid type values.
|
97
|
-
# @param data [String] data to compute hash value
|
98
|
-
#
|
99
|
-
# @return (String) computed hash as hex-encoded string
|
100
|
-
#
|
101
|
-
# @example
|
102
|
-
# SHA3::Digest.hexdigest(256, 'compute me, please')
|
103
|
-
# SHA3::Digest::SHA256.hexdigest('compute me, please') # => Alternate syntax
|
104
|
-
def self.hexdigest(type, data); end
|
105
|
-
|
106
|
-
# Returns computed hash value for given hash type, and data in bytes.
|
107
|
-
#
|
108
|
-
# @param type [Number, Symbol] See {#initialize} for valid type values.
|
109
|
-
# @param data [String] data to compute hash value
|
110
|
-
#
|
111
|
-
# @return [String] computed hash in bytes
|
112
|
-
#
|
113
|
-
# @example
|
114
|
-
# SHA3::Digest.digest(256, 'compute me, please')
|
115
|
-
# SHA3::Digest::SHA256.digest('compute me, please') # => Alternate syntax
|
116
|
-
def self.digest(type, data); end
|
117
|
-
end
|
118
|
-
|
119
|
-
class DigestError < StandardError
|
120
|
-
end
|
121
|
-
end
|
data/lib/sha3/version.rb
DELETED
data/sha3.gemspec
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'lib/sha3/version'
|
4
|
-
|
5
|
-
# rubocop:disable Metrics/BlockLength(Rubocop)
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'sha3'
|
8
|
-
spec.version = SHA3::VERSION
|
9
|
-
|
10
|
-
spec.authors = ['Johanns Gregorian']
|
11
|
-
spec.email = ['io+sha3@jsg.io']
|
12
|
-
|
13
|
-
spec.description = 'A XKCP based native (C) binding to SHA3 (FIPS 202) cryptographic hashing algorithm.'
|
14
|
-
spec.summary = 'SHA3 (FIPS 202) cryptographic hashing algorithm'
|
15
|
-
|
16
|
-
spec.homepage = 'https://github.com/johanns/sha3'
|
17
|
-
spec.license = 'MIT'
|
18
|
-
spec.required_ruby_version = '>= 2.6.0'
|
19
|
-
|
20
|
-
spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
|
21
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
22
|
-
spec.metadata['source_code_uri'] = spec.homepage
|
23
|
-
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
25
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
28
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
spec.bindir = 'exe'
|
33
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
|
-
spec.extensions = ['ext/sha3/extconf.rb']
|
35
|
-
spec.require_paths = ['lib']
|
36
|
-
|
37
|
-
# Uncomment to register a new dependency of your gem
|
38
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
39
|
-
|
40
|
-
# For more information and examples about making a new gem, check out our
|
41
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
42
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
43
|
-
|
44
|
-
spec.add_development_dependency('rake', '~> 13.0')
|
45
|
-
spec.add_development_dependency('rake-compiler', '~> 1.2')
|
46
|
-
spec.add_development_dependency('rspec', '~> 3.11')
|
47
|
-
spec.add_development_dependency('rubocop', '~> 1.37')
|
48
|
-
spec.add_development_dependency('rubocop-rake', '~> 0.6')
|
49
|
-
spec.add_development_dependency('rubocop-rspec', '~> 2.14')
|
50
|
-
|
51
|
-
spec.cert_chain = ['certs/johanns.pem']
|
52
|
-
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
|
53
|
-
end
|
54
|
-
# rubocop:enable Metrics/BlockLength(Rubocop)
|
data/tests.sh
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
rm -fv spec/sha3_compute*.rb
|
4
|
-
rm -fv spec/sha3_digest*.rb
|
5
|
-
|
6
|
-
if [ -d "spec/data" ]
|
7
|
-
then
|
8
|
-
rm -rfv spec/data/*
|
9
|
-
else
|
10
|
-
mkdir "spec/data"
|
11
|
-
fi
|
12
|
-
|
13
|
-
pushd "spec/data"
|
14
|
-
if [ -f "*.txt" ]
|
15
|
-
then
|
16
|
-
rm -v *.txt
|
17
|
-
fi
|
18
|
-
|
19
|
-
curl "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-224.txt" > ShortMsgKAT_SHA3-224.txt
|
20
|
-
curl "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-256.txt" > ShortMsgKAT_SHA3-256.txt
|
21
|
-
curl "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-384.txt" > ShortMsgKAT_SHA3-384.txt
|
22
|
-
curl "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-512.txt" > ShortMsgKAT_SHA3-512.txt
|
23
|
-
popd
|
24
|
-
|
25
|
-
pushd spec
|
26
|
-
ruby generate_tests.rb
|
27
|
-
popd
|
28
|
-
|
29
|
-
rake
|