sha3 2.0.0 → 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 +1 -1
- data/.document +1 -2
- data/.rdoc_options +1 -0
- data/.rubocop.yml +3 -0
- data/Gemfile +1 -0
- data/README.md +37 -4
- data/Rakefile +4 -2
- data/doc/sha3.rb +2 -0
- data/ext/sha3/config.h +2 -2
- data/ext/sha3/digest.c +296 -211
- data/ext/sha3/digest.h +1 -66
- data/ext/sha3/extconf.rb +3 -3
- data/ext/sha3/kmac.c +504 -0
- data/ext/sha3/kmac.h +14 -0
- data/ext/sha3/sha3.c +31 -0
- data/ext/sha3/sha3.h +17 -0
- data/lib/constants.rb +5 -0
- data/lib/sha3.rb +28 -24
- data.tar.gz.sig +0 -0
- metadata +15 -21
- metadata.gz.sig +0 -0
data/lib/sha3.rb
CHANGED
@@ -1,34 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'constants'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
sha3_256: 'SHA3_256',
|
8
|
-
sha3_384: 'SHA3_384',
|
9
|
-
sha3_512: 'SHA3_512',
|
10
|
-
shake_128: 'SHAKE_128',
|
11
|
-
shake_256: 'SHAKE_256'
|
12
|
-
}
|
5
|
+
module SHA3
|
6
|
+
require 'sha3_ext'
|
13
7
|
|
14
|
-
alg
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
alg = {
|
9
|
+
sha3_224: 'SHA3_224',
|
10
|
+
sha3_256: 'SHA3_256',
|
11
|
+
sha3_384: 'SHA3_384',
|
12
|
+
sha3_512: 'SHA3_512',
|
13
|
+
shake_128: 'SHAKE_128',
|
14
|
+
shake_256: 'SHAKE_256'
|
15
|
+
}
|
16
|
+
|
17
|
+
alg.each do |key, name|
|
18
|
+
klass = Class.new(Digest) do
|
19
|
+
define_method(:initialize) do |*data|
|
20
|
+
if data.length > 1
|
21
|
+
raise ArgumentError,
|
22
|
+
"wrong number of arguments (#{data.length} for 1)"
|
23
|
+
end
|
24
|
+
|
25
|
+
super(key, data.first)
|
20
26
|
end
|
27
|
+
end
|
21
28
|
|
22
|
-
|
29
|
+
singleton = (class << klass; self; end)
|
30
|
+
singleton.class_eval do
|
31
|
+
define_method(:digest) { |data| Digest.digest(key, data) }
|
32
|
+
define_method(:hexdigest) { |data| Digest.hexdigest(key, data) }
|
23
33
|
end
|
24
|
-
end
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
define_method(:digest) { |data| SHA3::Digest.digest(key, data) }
|
29
|
-
define_method(:hexdigest) { |data| SHA3::Digest.hexdigest(key, data) }
|
35
|
+
# Define the class under SHA3::Digest
|
36
|
+
SHA3::Digest.const_set(name, klass)
|
30
37
|
end
|
31
|
-
|
32
|
-
# Define the class under SHA3::Digest
|
33
|
-
SHA3::Digest.const_set(name, klass)
|
34
38
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sha3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johanns Gregorian
|
@@ -34,24 +34,12 @@ cert_chain:
|
|
34
34
|
UjZtrp/rHLfHln46RvB+a1NlMRWxtJ7mQc/CMEbT+cpHlzuYa9qGakA4TmMpK10h
|
35
35
|
uYUv/V6CD4iTEMby0dopwHt5NqE=
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2025-03-
|
38
|
-
dependencies:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- - "~>"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '6.12'
|
46
|
-
type: :runtime
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '6.12'
|
53
|
-
description: A XKCP based native (C) binding to SHA3 (FIPS 202) cryptographic hashing
|
54
|
-
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.'
|
55
43
|
email:
|
56
44
|
- io+sha3@jsg.io
|
57
45
|
executables: []
|
@@ -75,6 +63,8 @@ files:
|
|
75
63
|
- ext/sha3/digest.c
|
76
64
|
- ext/sha3/digest.h
|
77
65
|
- ext/sha3/extconf.rb
|
66
|
+
- ext/sha3/kmac.c
|
67
|
+
- ext/sha3/kmac.h
|
78
68
|
- ext/sha3/lib/common/align.h
|
79
69
|
- ext/sha3/lib/common/brg_endian.h
|
80
70
|
- ext/sha3/lib/high/Keccak/FIPS202/KeccakHash.c
|
@@ -102,6 +92,9 @@ files:
|
|
102
92
|
- ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h
|
103
93
|
- ext/sha3/lib/low/common/PlSnP-Fallback.inc
|
104
94
|
- ext/sha3/lib/low/common/SnP-Relaned.h
|
95
|
+
- ext/sha3/sha3.c
|
96
|
+
- ext/sha3/sha3.h
|
97
|
+
- lib/constants.rb
|
105
98
|
- lib/sha3.rb
|
106
99
|
homepage: https://github.com/johanns/sha3
|
107
100
|
licenses:
|
@@ -109,7 +102,7 @@ licenses:
|
|
109
102
|
metadata:
|
110
103
|
changelog_uri: https://github.com/johanns/sha3/CHANGELOG.md
|
111
104
|
homepage_uri: https://github.com/johanns/sha3
|
112
|
-
documentation_uri: https://docs.jsg.io/sha3/
|
105
|
+
documentation_uri: https://docs.jsg.io/sha3/index.html
|
113
106
|
rubygems_mfa_required: 'true'
|
114
107
|
post_install_message: |2
|
115
108
|
[NOTICE] SHA3 version 2.0 introduces breaking changes to the API.
|
@@ -131,5 +124,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
124
|
requirements: []
|
132
125
|
rubygems_version: 3.6.2
|
133
126
|
specification_version: 4
|
134
|
-
summary: SHA3 (FIPS 202) cryptographic hashing
|
127
|
+
summary: 'SHA3 (FIPS 202) cryptographic hashing algorithms: SHA3-224/256/384/512,
|
128
|
+
SHAKE128/256, and KMAC'
|
135
129
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|