sha3 1.0.5 → 2.0.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.clang-format +54 -0
  4. data/.document +4 -3
  5. data/.rdoc_options +10 -0
  6. data/.rspec +2 -2
  7. data/.rubocop.yml +5 -1
  8. data/CHANGELOG.md +23 -0
  9. data/Gemfile +11 -0
  10. data/LICENSE.txt +1 -1
  11. data/README.md +154 -67
  12. data/Rakefile +9 -3
  13. data/certs/io+sha3@jsg.io.pem +26 -0
  14. data/doc/sha3.rb +81 -0
  15. data/ext/sha3/digest.c +635 -163
  16. data/ext/sha3/digest.h +71 -35
  17. data/ext/sha3/extconf.rb +42 -38
  18. data/ext/sha3/lib/high/Keccak/KeccakDuplex.c +81 -0
  19. data/ext/sha3/lib/high/Keccak/KeccakDuplex.h +73 -0
  20. data/ext/sha3/lib/high/Keccak/KeccakDuplex.inc +201 -0
  21. data/ext/sha3/lib/high/Keccak/KeccakSponge.c +2 -18
  22. data/ext/sha3/lib/high/Keccak/KeccakSponge.h +4 -10
  23. data/ext/sha3/lib/high/Keccak/KeccakSponge.inc +27 -31
  24. data/ext/sha3/lib/high/Keccak/PRG/KeccakPRG.c +61 -0
  25. data/ext/sha3/lib/high/Keccak/PRG/KeccakPRG.h +67 -0
  26. data/ext/sha3/lib/high/Keccak/PRG/KeccakPRG.inc +128 -0
  27. data/ext/sha3/lib/high/Keccak/SP800-185/SP800-185.c +93 -0
  28. data/ext/sha3/lib/high/Keccak/SP800-185/SP800-185.h +599 -0
  29. data/ext/sha3/lib/high/Keccak/SP800-185/SP800-185.inc +573 -0
  30. data/ext/sha3/lib/high/common/Phases.h +25 -0
  31. data/ext/sha3/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros +19 -9
  32. data/ext/sha3/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +18 -12
  33. data/ext/sha3/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +28 -36
  34. data/ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +18 -12
  35. data/ext/sha3/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +28 -59
  36. data/ext/sha3/lib/low/common/PlSnP-Fallback.inc +291 -0
  37. data/ext/sha3/lib/low/common/SnP-Relaned.h +145 -0
  38. data/lib/sha3.rb +25 -28
  39. data.tar.gz.sig +0 -0
  40. metadata +55 -115
  41. metadata.gz.sig +0 -0
  42. data/.yardopts +0 -1
  43. data/ChangeLog.rdoc +0 -27
  44. data/certs/johanns.pem +0 -25
  45. data/ext/sha3/sha3.c +0 -62
  46. data/ext/sha3/sha3.h +0 -26
  47. data/lib/sha3/doc.rb +0 -121
  48. data/lib/sha3/version.rb +0 -9
  49. data/sha3.gemspec +0 -54
  50. data/tests.sh +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16edba407e859ee7afacc8a405666ec66cab0052cd7788e79089bd3f0d295844
4
- data.tar.gz: 5552886038bbec790d086599cbbe6ad09a0c3561b58a9a2dfff2b9c9834b7154
3
+ metadata.gz: c29bcfb557e028701b34ce0d2be3cdbec41882e45cedcb2f129e874bbb3867e5
4
+ data.tar.gz: 12c260b599a433def09b389d0cd39e72ebe2dae4e495979235aece99f2684e25
5
5
  SHA512:
6
- metadata.gz: a8e36ae984df177684d4b1a70689a80824e9d9ee70fd07812eaa50c8f0cd90a90f292dca435764842b737fb268084d09fa5f47450bdc9cf93316253c70484945
7
- data.tar.gz: a643ded4e2f9828d732f428eba1757c6cc383797f32b52ba7427dae8234ac9bc0e158712ccf64d7be77f2538b80904efaf26a0e455ce9515f9a76679929054c0
6
+ metadata.gz: 1be97184feef60e8340b6dd009f5c8eabcc6b2b72b050d2a3f08ef93d9c11184c7a9c1246f2cf241ef62d47fc13b96a62bab8b61002001b04942162dc9a7dd82
7
+ data.tar.gz: ca4d24baf5cda13fb0f071640875a16182aa234dca43b85d5d81e05ec80a9d3d1ea89b98b0f7f6a621d6395e6647472ef131c9dd2979f942556137108079ca80
checksums.yaml.gz.sig CHANGED
Binary file
data/.clang-format ADDED
@@ -0,0 +1,54 @@
1
+ BasedOnStyle: Google # Use Google's style as a foundation
2
+ AccessModifierOffset: -1
3
+ AlignAfterOpenBracket: Align
4
+ AlignConsecutiveAssignments: false
5
+ AlignConsecutiveDeclarations: false
6
+ AlignEscapedNewlines: Left
7
+ AlignOperands: true
8
+ AlignTrailingComments: true
9
+ AllowAllParametersOfDeclarationOnNextLine: true
10
+ AllowShortBlocksOnASingleLine: false
11
+ AllowShortCaseLabelsOnASingleLine: false
12
+ AllowShortFunctionsOnASingleLine: Empty
13
+ AllowShortIfStatementsOnASingleLine: false
14
+ AllowShortLoopsOnASingleLine: false
15
+ AlwaysBreakAfterDefinitionReturnType: None
16
+ AlwaysBreakAfterReturnType: None
17
+ AlwaysBreakBeforeMultilineStrings: true
18
+ AlwaysBreakTemplateDeclarations: Yes
19
+ BinPackArguments: true
20
+ BinPackParameters: true
21
+ BreakBeforeBraces: Attach
22
+ BreakBeforeTernaryOperators: true
23
+ ColumnLimit: 100
24
+ CompactNamespaces: false
25
+ ConstructorInitializerAllOnOneLineOrOnePerLine: true
26
+ Cpp11BracedListStyle: true
27
+ DerivePointerAlignment: false
28
+ FixNamespaceComments: true
29
+ IncludeBlocks: Regroup
30
+ IndentCaseLabels: true
31
+ IndentPPDirectives: None
32
+ IndentWidth: 4
33
+ KeepEmptyLinesAtTheStartOfBlocks: false
34
+ Language: Cpp
35
+ MaxEmptyLinesToKeep: 1
36
+ NamespaceIndentation: None
37
+ PointerAlignment: Left
38
+ ReflowComments: true
39
+ SortIncludes: true
40
+ SortUsingDeclarations: true
41
+ SpaceAfterCStyleCast: false
42
+ SpaceAfterTemplateKeyword: true
43
+ SpaceBeforeAssignmentOperators: true
44
+ SpaceBeforeParens: ControlStatements
45
+ SpaceInEmptyParentheses: false
46
+ SpacesBeforeTrailingComments: 2
47
+ SpacesInAngles: false
48
+ SpacesInContainerLiterals: false
49
+ SpacesInCStyleCastParentheses: false
50
+ SpacesInParentheses: false
51
+ SpacesInSquareBrackets: false
52
+ Standard: Auto
53
+ TabWidth: 2
54
+ UseTab: Never
data/.document CHANGED
@@ -1,4 +1,5 @@
1
- -
2
- README.rdoc
3
- ChangeLog.rdoc
1
+ README.md
4
2
  LICENSE.txt
3
+ lib/**/*.rb
4
+ ext/sha3/digest.{c,h}
5
+ doc/**/*.rb
data/.rdoc_options ADDED
@@ -0,0 +1,10 @@
1
+ ---
2
+ main_page: README.md
3
+ title: SHA3
4
+
5
+ charset: UTF-8
6
+ encoding: UTF-8
7
+ force_update: true
8
+ markup: rdoc
9
+ op_dir: html
10
+ visibility: :private
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
1
+ --require spec_helper
2
2
  --color
3
- --require ./spec/spec_helper
3
+ --format documentation
data/.rubocop.yml CHANGED
@@ -1,6 +1,10 @@
1
+ plugins:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
1
5
  AllCops:
2
6
  NewCops: enable
3
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 2.7
4
8
 
5
9
  Layout/LineLength:
6
10
  Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # SHA3 Ruby Gem Changelog
2
+
3
+ ## v1.0.5 (2022-10-23)
4
+
5
+ ### Security
6
+ - Fixed buffer overflow vulnerability in Keccak implementation by updating to latest XKCP library
7
+ - Added test to verify fix for buffer overflow vulnerability
8
+
9
+ ### Improvements
10
+ - Updated XKCP library with improved directory structure
11
+ - Refactored byte-length test vector generator
12
+
13
+ ### Documentation
14
+ - Updated README with current supported Ruby versions
15
+ - Added credits section to README
16
+ - Fixed typo in README
17
+ - Updated gem description
18
+
19
+ ### Maintenance
20
+ - Updated development dependencies
21
+ - Removed bundler from development dependencies list
22
+ - Updated signing certificate
23
+ - Added macOS file types to .gitignore
data/Gemfile CHANGED
@@ -3,3 +3,14 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ group :development, :test do
8
+ gem 'irb'
9
+
10
+ gem 'rake', '~> 13'
11
+ gem 'rake-compiler', '~> 1'
12
+ gem 'rspec', '~> 3'
13
+ gem 'rubocop', '~> 1'
14
+ gem 'rubocop-rake', '~> 0.7'
15
+ gem 'rubocop-rspec', '~> 3'
16
+ end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Johanns Gregorian
1
+ Copyright (c) 2025 Johanns Gregorian
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,123 +1,210 @@
1
- # sha3
1
+ # SHA3 for Ruby
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/sha3.svg)](https://badge.fury.io/rb/sha3) [![Ruby](https://github.com/johanns/sha3/actions/workflows/main.yml/badge.svg)](https://github.com/johanns/sha3/actions/workflows/main.yml)
4
4
 
5
- **SHA3 for Ruby** is a XKCP based native (C) binding to SHA3 (FIPS 202) cryptographic hashing algorithm.
5
+ A high-performance native binding to the SHA3 (FIPS 202) cryptographic hashing algorithm, based on the [XKCP - eXtended Keccak Code Package](https://github.com/XKCP/XKCP).
6
+
7
+ > [!CAUTION]
8
+ > **Security Notice**: Do not use SHA-3 for hashing passwords. Instead, use a slow hashing function such as PBKDF2, Argon2, bcrypt, or scrypt.
9
+
10
+ > [!IMPORTANT]
11
+ > **Breaking Changes**: SHA3 version 2.0 introduces breaking changes to the API. Please review the changelog and ensure compatibility with your application.
12
+ > If you need the previous behavior, lock your Gemfile to version '~> 1.0'.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Documentation](#documentation)
17
+ - [Features](#features)
18
+ - [Installation](#installation)
19
+ - [Usage](#usage)
20
+ - [SHA-3 Fixed Hash Functions](#sha-3-fixed-hash-functions)
21
+ - [SHAKE128/256 Functions](#shake128256-functions)
22
+ - [Alternate Class Syntax](#alternate-class-syntax)
23
+ - [Hashing a File](#hashing-a-file)
24
+ - [Development](#development)
25
+ - [Dependencies](#dependencies)
26
+ - [Testing](#testing)
27
+ - [Supported Ruby Versions](#supported-ruby-versions)
28
+ - [Contributing](#contributing)
29
+ - [Roadmap](#roadmap)
30
+ - [License](#license)
31
+ - [Credits](#credits)
32
+
33
+ ## Documentation
34
+
35
+ - [API Documentation](https://docs.jsg.io/sha3/html/index.html)
36
+ - [GitHub Repository](https://github.com/johanns/sha3#readme)
37
+ - [Issue Tracker](https://github.com/johanns/sha3/issues)
38
+
39
+ ## Features
40
+
41
+ - Full support for all SHA-3 variants (224, 256, 384, and 512 bit)
42
+ - Support for SHAKE128 and SHAKE256 extendable-output functions (XOFs)
43
+ - Native C implementation for high performance
44
+ - Simple, Ruby-friendly API that follows Ruby's standard Digest interface
45
+ - Comprehensive test suite with official NIST test vectors
46
+ - Thread-safe implementation
6
47
 
7
- - [Home](https://github.com/johanns/sha3#readme)
8
- - [Issues](https://github.com/johanns/sha3/issues)
9
- - [Documentation](http://rubydoc.info/gems/sha3/frames)
10
- - [XKCP - eXtended Keccak Code Package](https://github.com/XKCP/XKCP)
11
-
12
- ## Warning
48
+ ## Installation
13
49
 
14
- - Please do NOT use SHA3 to hash passwords -- use a slow hashing function instead (e.g.: `pbkdf2`, `argon2`, `bcrypt` or `scrypt`)
15
- - Version 1.0 introduces new API and is incompatible with previous versions (0.x).
50
+ Add this line to your application's Gemfile:
16
51
 
17
- ## Module details
52
+ ```ruby
53
+ gem 'sha3', '~> 2.0'
54
+ ```
18
55
 
19
- **SHA3::Digest**: A standard *Digest* _subclass_. The interface, and operation of this class are parallel to digest classes bundled with MRI-based Rubies (e.g.: **Digest::SHA2**, and **OpenSSL::Digest**).
56
+ And then execute:
20
57
 
21
- See [documentation for Ruby's **Digest** class for additional details](http://www.ruby-doc.org/stdlib-2.2.3/libdoc/digest/rdoc/Digest.html).
58
+ ```sh
59
+ bundle install
60
+ ```
22
61
 
23
- ## Installation
62
+ Or install it yourself as:
24
63
 
25
- ```shell
64
+ ```sh
26
65
  gem install sha3
27
66
  ```
28
67
 
29
68
  ## Usage
30
69
 
70
+ ### SHA-3 Fixed Hash Functions
71
+
31
72
  ```ruby
32
73
  require 'sha3'
33
- ```
34
74
 
35
- Valid hash bit-lengths are: *224*, *256*, *384*, *512*.
75
+ # Create a new digest instance
76
+ digest = SHA3::Digest.new(:sha3_224, 'Start here')
36
77
 
37
- ```ruby
38
- :sha224 :sha256 :sha384 :sha512
78
+ # Add more data to be hashed
79
+ digest << "Compute Me"
80
+ digest.update("Me too")
81
+
82
+ # Get the final hash value as a hex string
83
+ digest.hexdigest
84
+ # => "d6d38021d60857..."
39
85
 
40
- # SHA3::Digest.new(224) is SHA3::Digest.new(:sha224)
86
+ # Or as a binary string
87
+ digest.digest
41
88
  ```
42
89
 
43
- Alternatively, you can instantiate using one of four sub-classes:
90
+ Valid algorithm symbols are:
44
91
 
45
- ```ruby
46
- SHA3::Digest::SHA224.new() # 224 bits
47
- SHA3::Digest::SHA256.new() # 256 bits
48
- SHA3::Digest::SHA384.new() # 384 bits
49
- SHA3::Digest::SHA512.new() # 512 bits
50
- ```
92
+ - `:sha3_224` - SHA-3 224 bits
93
+ - `:sha3_256` - SHA-3 256 bits
94
+ - `:sha3_384` - SHA-3 384 bits
95
+ - `:sha3_512` - SHA-3 512 bits
96
+ - `:shake_128` - SHAKE128 extendable-output function
97
+ - `:shake_256` - SHAKE256 extendable-output function
51
98
 
52
- ### Basics
99
+ ### SHAKE128/256 Functions
100
+
101
+ SHAKE128 and SHAKE256 are extendable-output functions (XOFs) that allow you to "squeeze" an arbitrary number of bytes from the hash state:
53
102
 
54
103
  ```ruby
55
- # Instantiate a new SHA3::Digest class with 256 bit length
56
- s = SHA3::Digest.new(:sha256)
104
+ # Create a new SHAKE128 instance
105
+ shake = SHA3::Digest.new(:shake_128)
57
106
 
58
- # OR #
107
+ # Add data to be hashed
108
+ shake << 'Squeeze this data...'
59
109
 
60
- s = SHA3::Digest::SHA256.new()
110
+ # Squeeze 120 bytes (240 hex characters) from the hash state
111
+ result = shake.hex_squeeze(120)
61
112
 
62
- # Update hash state, and compute new value
63
- s.update "Compute Me"
113
+ # Or get binary output
114
+ binary_result = shake.squeeze(1024)
64
115
 
65
- # << is an .update() alias
66
- s << "Me too"
116
+ # You can call squeeze functions multiple times with arbitrary output lengths
117
+ first_part = shake.squeeze(32) # Get 32 bytes
118
+ second_part = shake.squeeze(64) # Get 64 bytes
119
+ third_part = shake.hex_squeeze(128) # Get 128 bytes as hex
120
+ ```
67
121
 
68
- # Returns digest value in bytes
69
- s.digest
70
- # => "\xBE\xDF\r\xD9\xA1..."
122
+ ### Alternate Class Syntax
71
123
 
72
- # Returns digest value as hex string
73
- s.hexdigest
74
- # => "bedf0dd9a15b647..."
124
+ For convenience, you can also use dedicated classes for each algorithm:
75
125
 
76
- ### Digest class-methods: ###
126
+ ```ruby
127
+ # Available classes
128
+ SHA3::Digest::SHA3_224.new([data])
129
+ SHA3::Digest::SHA3_256.new([data])
130
+ SHA3::Digest::SHA3_384.new([data])
131
+ SHA3::Digest::SHA3_512.new([data])
132
+ SHA3::Digest::SHAKE_128.new([data])
133
+ SHA3::Digest::SHAKE_256.new([data])
134
+ ```
135
+
136
+ ```ruby
137
+ # Example usage
138
+ digest = SHA3::Digest::SHA3_256.new('Start here')
77
139
 
78
- SHA3::Digest.hexdigest(:sha224, "Hash me, please")
79
- # => "200e7bc18cd613..."
140
+ digest << "Compute Me"
141
+ digest.update("Me too")
80
142
 
81
- SHA3::Digest::SHA384.digest("Hash me, please")
82
- # => "\xF5\xCEpC\xB0eV..."
143
+ digest.hexdigest
144
+ # => "bedf0dd9a15b647..."
83
145
  ```
84
146
 
85
- ### Hashing a file
147
+ ### Hashing a File
86
148
 
87
149
  ```ruby
88
- # Compute the hash value for given file, and return the result as hex
89
- s = SHA3::Digest::SHA224.file("my_fantastical_file.bin").hexdigest
150
+ # Compute the hash value for a given file, and return the result as hex
151
+ hash = SHA3::Digest::SHA3_256.file("my_file.bin").hexdigest
90
152
 
91
- # Calling SHA3::Digest.file(...) defaults to SHA256
92
- s = SHA3::Digest.file("tests.sh")
93
- # => #<SHA3::Digest: a9801db49389339...>
153
+ # Calling SHA3::Digest.file(...) defaults to SHA3_256
154
+ hash = SHA3::Digest.file("my_file.bin").hexdigest
155
+ # => "a9801db49389339..."
94
156
  ```
95
157
 
96
- ### Development Dependencies
158
+ ## Development
159
+
160
+ ### Dependencies
97
161
 
98
- * Native build tools (e.g., Clang/LLVM, GCC, Minigw, etc.)
99
- * Gems: rubygems-tasks, rake, rspec, yard
162
+ - **C/C++** compiler and native build tools (e.g., Clang/LLVM, GCC, MinGW, etc.)
163
+ - **Gems**: rake, rake-compiler, rspec, yard
100
164
 
101
165
  ### Testing
102
166
 
103
- Call ```rake``` to run the included RSpec tests.
167
+ Run `rake` to build and run the (RSpec) tests.
104
168
 
105
- Only a small subset of test vectors are included in the source repository; however, the complete test vectors suite is available for download. Simply run the ```tests.sh``` shell script (available in the root of source directory) to generate full byte-length RSpec test files.
169
+ To run the tests manually:
106
170
 
107
- ```sh tests.sh```
171
+ ```bash
172
+ bundle exec rspec
173
+ ```
108
174
 
109
- ### Rubies
175
+ The test suite includes a special `sha3_vectors_spec.rb` file that automatically:
176
+ 1. Downloads the official SHA3 test vectors from the XKCP repository
177
+ 2. Parses the test vectors
178
+ 3. Runs tests against all SHA3 variants (224, 256, 384, and 512 bit)
110
179
 
111
- Supported Ruby versions:
180
+ The test vectors are downloaded only once and cached in the `spec/data` directory for future test runs.
112
181
 
113
- - MRI Ruby 2.6 - 3.1
182
+ ### Supported Ruby Versions
114
183
 
115
- ## Credits
184
+ - MRI Ruby 2.7 - 3.1
116
185
 
117
- XKCP by Keccak team: [https://keccak.team/index.html]()
186
+ ## Roadmap
118
187
 
119
- ## Copyright
188
+ - [X] Add support for SHA-3 variants (224, 256, 384, and 512 bit)
189
+ - [X] Add support for SHAKE128 and SHAKE256 extendable-output functions (XOFs)
190
+ - [ ] Add support for cSHAKE, TurboSHANKE, and KMAC
191
+
192
+ ## Contributing
193
+
194
+ 1. Fork it
195
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
196
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
197
+ 4. Push to the branch (`git push origin my-new-feature`)
198
+ 5. Create new Pull Request
199
+
200
+ ## License
201
+
202
+ Copyright (c) 2012 - 2025 Johanns Gregorian (https://github.com/johanns)
203
+
204
+ Released under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.
205
+
206
+ ## Credits
120
207
 
121
- Copyright (c) 2012 - 2022 Johanns Gregorian (https://github.com/johanns)
208
+ - [XKCP - eXtended Keccak Code Package](https://github.com/XKCP/XKCP) by the Keccak team: [https://keccak.team/index.html](https://keccak.team/index.html)
209
+ - All contributors to the SHA3 for Ruby project
122
210
 
123
- **See LICENSE.txt for details.**
data/Rakefile CHANGED
@@ -1,19 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
4
 
5
+ require 'rspec/core/rake_task'
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  require 'rubocop/rake_task'
9
-
10
9
  RuboCop::RakeTask.new
11
10
 
12
11
  require 'rake/extensiontask'
13
12
 
14
13
  begin
15
14
  Rake::ExtensionTask.new :compile do |ext|
16
- ext.name = 'sha3_n'
15
+ ext.name = 'sha3_digest'
17
16
  ext.ext_dir = 'ext/sha3'
18
17
  ext.tmp_dir = 'tmp'
19
18
  ext.source_pattern = '*.{c}'
@@ -24,4 +23,11 @@ rescue LoadError
24
23
  end
25
24
  end
26
25
 
26
+ require 'rdoc/task'
27
+
28
+ RDoc::Task.new do |rdoc|
29
+ rdoc.rdoc_dir = '../docs/sha3'
30
+ rdoc.options << '--force-update'
31
+ end
32
+
27
33
  task default: %i[compile spec]
@@ -0,0 +1,26 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEYDCCAsigAwIBAgIBATANBgkqhkiG9w0BAQsFADA7MRAwDgYDVQQDDAdpb19z
3
+ aGEzMRMwEQYKCZImiZPyLGQBGRYDanNnMRIwEAYKCZImiZPyLGQBGRYCaW8wHhcN
4
+ MjUwMzAxMDYxMTE1WhcNMjYwMzAxMDYxMTE1WjA7MRAwDgYDVQQDDAdpb19zaGEz
5
+ MRMwEQYKCZImiZPyLGQBGRYDanNnMRIwEAYKCZImiZPyLGQBGRYCaW8wggGiMA0G
6
+ CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDMdO1oUQ9FzXYtfFktOXDx6oIf9uSk
7
+ mg+yfo7uvcyNSa4gsF4+CY/TOYNBtwlD25AlgDqpxVCHFwUaBD+MHKyd8p6Eto1Q
8
+ Bwb7YrjPOXlmCKQYr5sFfbjeUfQRKBUTAhzM0W/5Zh9C4gkOyZ/7SaU6mI/M/LgQ
9
+ dZsw2y6l2bAl4aZaXgbnO7B1rPTPr6yQRZTveacmeTGHav1WACdE36Txqyv2QA7+
10
+ +VdYx04fOe2FEipan7d4TA4XKW+0Z+VWyoWFNyyxJtiT53PB10lztPiycBqZ+A3L
11
+ aA2VjZekn3NFbsXMOa4fbSTMddb784IWEeySmTMu6W/yYpo1B1PbgRaD/z2Zg0Qj
12
+ SZ2ldqqk68nvFVWqUlRbT8ZY6McKC1VEbNLLk7jNvdbgr/VPo4Zu5TP3FXjsPlpz
13
+ 1duXTtAGtHjPnS+tdkSinKv4OmbTHid9gnoDcRjlNpWxoULs9iSNb6lOCUeBxvF6
14
+ 4Eh7nyIPmaTDwPQtg5/RTvjZMqprS8D3tKsCAwEAAaNvMG0wCQYDVR0TBAIwADAL
15
+ BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFLCWxOjmn5qTuhjFG7fwiPXzSIlFMBkGA1Ud
16
+ EQQSMBCBDmlvK3NoYTNAanNnLmlvMBkGA1UdEgQSMBCBDmlvK3NoYTNAanNnLmlv
17
+ MA0GCSqGSIb3DQEBCwUAA4IBgQC4Y5pXxtopzHiSBsg6fuozv7zHXXuYXOL2Bq2x
18
+ l8C8lYjC2pN/Fh+FlgrJkqAoJ0wBlh3+wkhYPhSehkUy/2HaUYYTd1Zv4Odw+C/Q
19
+ rQnN5+nIv+gMrLwoBXH9sFjAp/iYKd4cDz5aUVNrPqibj8zivcSqFJ9lsyOvIZO6
20
+ tajU2HVxXOkpTtLzMgPEGdwlFEd2tB7VCGFbrTskxrpv243b0HdpeEVh2e9dNkl4
21
+ XobOvUPXHzFTDucYe8jpCn7e7Cj43PpTZFnxIRJnO8cVpX6n7UG8+JgBSqvwuv5C
22
+ YwFBqP6G2+0e0EdIIMdbCDBTmJbFyBr6y4pzED/FvEFzhAmCKOcZ6RJ8H7hkX5rh
23
+ +L4c9pHTemc2sQl7kH+mrntu7pt6D4EM4FD5eyWujQN1ME7xvLIFm5SczqCzFDfe
24
+ UjZtrp/rHLfHln46RvB+a1NlMRWxtJ7mQc/CMEbT+cpHlzuYa9qGakA4TmMpK10h
25
+ uYUv/V6CD4iTEMby0dopwHt5NqE=
26
+ -----END CERTIFICATE-----
data/doc/sha3.rb ADDED
@@ -0,0 +1,81 @@
1
+ module SHA3
2
+ module Digest
3
+ # SHA3_224 is a cryptographic hash function that produces a 224-bit (28-byte) hash value.
4
+ #
5
+ # Usage:
6
+ # digest = SHA3::Digest::SHA3_224.new
7
+ # digest.update("message")
8
+ # hash = digest.hexdigest
9
+ #
10
+ # # Or more simply:
11
+ # hash = SHA3::Digest::SHA3_224.hexdigest("message")
12
+ #
13
+ # See SHA3::Digest for complete API list and additional documentation.
14
+ class SHA3_224 < ::Digest::Class; end
15
+
16
+ # SHA3_256 is a cryptographic hash function that produces a 256-bit (32-byte) hash value.
17
+ #
18
+ # Usage:
19
+ # digest = SHA3::Digest::SHA3_256.new
20
+ # digest.update("message")
21
+ # hash = digest.hexdigest
22
+ #
23
+ # # Or more simply:
24
+ # hash = SHA3::Digest::SHA3_256.hexdigest("message")
25
+ #
26
+ # See SHA3::Digest for complete API list and additional documentation.
27
+ class SHA3_256 < ::Digest::Class; end
28
+
29
+ # SHA3_384 is a cryptographic hash function that produces a 384-bit (48-byte) hash value.
30
+ #
31
+ # Usage:
32
+ # digest = SHA3::Digest::SHA3_384.new
33
+ # digest.update("message")
34
+ # hash = digest.hexdigest
35
+ #
36
+ # # Or more simply:
37
+ # hash = SHA3::Digest::SHA3_384.hexdigest("message")
38
+ #
39
+ # See SHA3::Digest for complete API list and additional documentation.
40
+ class SHA3_384 < ::Digest::Class; end
41
+
42
+ # SHA3_512 is a cryptographic hash function that produces a 512-bit (64-byte) hash value.
43
+ #
44
+ # Usage:
45
+ # digest = SHA3::Digest::SHA3_512.new
46
+ # digest.update("message")
47
+ # hash = digest.hexdigest
48
+ #
49
+ # # Or more simply:
50
+ # hash = SHA3::Digest::SHA3_512.hexdigest("message")
51
+ #
52
+ # See SHA3::Digest for complete API list and additional documentation.
53
+ class SHA3_512 < ::Digest::Class; end
54
+
55
+ # SHAKE_128 is an extendable-output function (XOF) that can produce hash values of any desired length.
56
+ #
57
+ # Usage:
58
+ # digest = SHA3::Digest::SHAKE_128.new
59
+ # digest.update("message")
60
+ # hash = digest.hexdigest(32) # Get 32 bytes (64 hex chars) of output
61
+ #
62
+ # # Or more simply:
63
+ # hash = SHA3::Digest::SHAKE_128.hexdigest("message", 32)
64
+ #
65
+ # See SHA3::Digest for complete API list and additional documentation.
66
+ class SHAKE_128 < ::Digest::Class; end
67
+
68
+ # SHAKE_256 is an extendable-output function (XOF) that can produce hash values of any desired length.
69
+ #
70
+ # Usage:
71
+ # digest = SHA3::Digest::SHAKE_256.new
72
+ # digest.update("message")
73
+ # hash = digest.hexdigest(32) # Get 32 bytes (64 hex chars) of output
74
+ #
75
+ # # Or more simply:
76
+ # hash = SHA3::Digest::SHAKE_256.hexdigest("message", 32)
77
+ #
78
+ # See SHA3::Digest for complete API list and additional documentation.
79
+ class SHAKE_256 < ::Digest::Class; end
80
+ end
81
+ end