sha3 0.2.5 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sha3 might be problematic. Click here for more details.

Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +232 -20
  3. data/.travis.yml +18 -12
  4. data/Gemfile +1 -1
  5. data/Gemfile.ci +5 -5
  6. data/LICENSE.txt +1 -1
  7. data/README.md +120 -0
  8. data/Rakefile +15 -18
  9. data/ext/sha3/KeccakF-1600-interface.h +28 -34
  10. data/ext/sha3/KeccakHash.c +80 -0
  11. data/ext/sha3/KeccakHash.h +110 -0
  12. data/ext/sha3/KeccakSponge.c +127 -201
  13. data/ext/sha3/KeccakSponge.h +74 -37
  14. data/ext/sha3/Optimized64/KeccakF-1600-64.macros +2199 -0
  15. data/ext/sha3/Optimized64/KeccakF-1600-opt64-settings.h +3 -0
  16. data/ext/sha3/Optimized64/KeccakF-1600-opt64.c +508 -0
  17. data/ext/sha3/{KeccakF-1600-unrolling.macros → Optimized64/KeccakF-1600-unrolling.macros} +16 -14
  18. data/ext/sha3/Optimized64/SnP-interface.h +47 -0
  19. data/ext/sha3/Reference/KeccakF-1600-reference.c +311 -0
  20. data/ext/sha3/Reference/KeccakF-reference.h +26 -0
  21. data/ext/sha3/Reference/SnP-FBWL-default.c +96 -0
  22. data/ext/sha3/Reference/SnP-FBWL-default.h +26 -0
  23. data/ext/sha3/Reference/SnP-interface.h +42 -0
  24. data/ext/sha3/{displayIntermediateValues.c → Reference/displayIntermediateValues.c} +52 -11
  25. data/ext/sha3/{displayIntermediateValues.h → Reference/displayIntermediateValues.h} +11 -6
  26. data/ext/sha3/SnP-Relaned.h +249 -0
  27. data/ext/sha3/brg_endian.h +0 -0
  28. data/ext/sha3/digest.c +182 -167
  29. data/ext/sha3/digest.h +37 -29
  30. data/ext/sha3/extconf.rb +13 -13
  31. data/ext/sha3/sha3.c +46 -30
  32. data/ext/sha3/sha3.h +10 -9
  33. data/lib/sha3/doc.rb +26 -39
  34. data/lib/sha3/version.rb +2 -3
  35. data/sha3.gemspec +13 -15
  36. data/spec/generate_tests.rb +22 -57
  37. data/spec/sha3_core_spec.rb +111 -133
  38. data/spec/spec_helper.rb +2 -2
  39. data/tests.sh +11 -9
  40. metadata +46 -51
  41. data/README.rdoc +0 -132
  42. data/ext/sha3/KeccakF-1600-32-rvk.macros +0 -555
  43. data/ext/sha3/KeccakF-1600-32-s1.macros +0 -1187
  44. data/ext/sha3/KeccakF-1600-32-s2.macros +0 -1187
  45. data/ext/sha3/KeccakF-1600-32.macros +0 -26
  46. data/ext/sha3/KeccakF-1600-64.macros +0 -728
  47. data/ext/sha3/KeccakF-1600-int-set.h +0 -6
  48. data/ext/sha3/KeccakF-1600-opt.c +0 -504
  49. data/ext/sha3/KeccakF-1600-opt32-settings.h +0 -4
  50. data/ext/sha3/KeccakF-1600-opt32.c-arch +0 -524
  51. data/ext/sha3/KeccakF-1600-opt64-settings.h +0 -7
  52. data/ext/sha3/KeccakF-1600-opt64.c-arch +0 -504
  53. data/ext/sha3/KeccakF-1600-reference.c-arch +0 -300
  54. data/ext/sha3/KeccakF-1600-x86-64-gas.s +0 -766
  55. data/ext/sha3/KeccakF-1600-x86-64-shld-gas.s +0 -766
  56. data/ext/sha3/KeccakNISTInterface.c +0 -81
  57. data/ext/sha3/KeccakNISTInterface.h +0 -70
data/tests.sh CHANGED
@@ -3,24 +3,26 @@
3
3
  rm -fv spec/sha3_compute*.rb
4
4
  rm -fv spec/sha3_digest*.rb
5
5
 
6
- if [ -d "spec/data" ]
6
+ if [ -d "spec/data" ]
7
7
  then
8
- rm -rfv spec/data/*
8
+ rm -rfv spec/data/*
9
9
  else
10
- mkdir "spec/data"
10
+ mkdir "spec/data"
11
11
  fi
12
12
 
13
- cd "spec/data"
13
+ pushd "spec/data"
14
14
 
15
- if [ -f "KeccakTestVectors.zip" ]
15
+ if [ -f "*.txt" ]
16
16
  then
17
- rm -v "KeccakTestVectors.zip"
17
+ rm -v *.txt
18
18
  fi
19
19
 
20
- wget "http://cloud.github.com/downloads/johanns/sha3/KeccakTestVectors.zip"
21
- unzip KeccakTestVectors.zip
20
+ wget "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-224.txt"
21
+ wget "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-256.txt"
22
+ wget "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-384.txt"
23
+ wget "https://raw.githubusercontent.com/XKCP/XKCP/master/tests/TestVectors/ShortMsgKAT_SHA3-512.txt"
22
24
 
23
25
  cd ".."
24
26
 
25
27
  ruby generate_tests.rb
26
- rake
28
+ rake
metadata CHANGED
@@ -1,115 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sha3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johanns Gregorian
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-21 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.4'
33
+ version: '3.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.4'
40
+ version: '3.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubygems-tasks
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.8'
61
+ version: '0.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.8'
69
- description: SHA3 for Ruby is a native (C) implementation of Keccak (SHA3) cryptographic
70
- hashing algorithm.
71
- email: io+sha3@jsani.com
68
+ version: '0.9'
69
+ description: SHA3 for Ruby is a native (C) FIPS 202 compliant implementation of SHA3
70
+ (Keccak) cryptographic hashing algorithm.
71
+ email: io+sha3@jsg.io
72
72
  executables: []
73
73
  extensions:
74
74
  - ext/sha3/extconf.rb
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .document
78
- - .gitignore
79
- - .rspec
80
- - .travis.yml
81
- - .yardopts
77
+ - ".document"
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - ".yardopts"
82
82
  - ChangeLog.rdoc
83
83
  - Gemfile
84
84
  - Gemfile.ci
85
85
  - LICENSE.txt
86
- - README.rdoc
86
+ - README.md
87
87
  - Rakefile
88
- - ext/sha3/KeccakF-1600-32-rvk.macros
89
- - ext/sha3/KeccakF-1600-32-s1.macros
90
- - ext/sha3/KeccakF-1600-32-s2.macros
91
- - ext/sha3/KeccakF-1600-32.macros
92
- - ext/sha3/KeccakF-1600-64.macros
93
- - ext/sha3/KeccakF-1600-int-set.h
94
88
  - ext/sha3/KeccakF-1600-interface.h
95
- - ext/sha3/KeccakF-1600-opt.c
96
- - ext/sha3/KeccakF-1600-opt32-settings.h
97
- - ext/sha3/KeccakF-1600-opt32.c-arch
98
- - ext/sha3/KeccakF-1600-opt64-settings.h
99
- - ext/sha3/KeccakF-1600-opt64.c-arch
100
- - ext/sha3/KeccakF-1600-reference.c-arch
101
- - ext/sha3/KeccakF-1600-unrolling.macros
102
- - ext/sha3/KeccakF-1600-x86-64-gas.s
103
- - ext/sha3/KeccakF-1600-x86-64-shld-gas.s
104
- - ext/sha3/KeccakNISTInterface.c
105
- - ext/sha3/KeccakNISTInterface.h
89
+ - ext/sha3/KeccakHash.c
90
+ - ext/sha3/KeccakHash.h
106
91
  - ext/sha3/KeccakSponge.c
107
92
  - ext/sha3/KeccakSponge.h
93
+ - ext/sha3/Optimized64/KeccakF-1600-64.macros
94
+ - ext/sha3/Optimized64/KeccakF-1600-opt64-settings.h
95
+ - ext/sha3/Optimized64/KeccakF-1600-opt64.c
96
+ - ext/sha3/Optimized64/KeccakF-1600-unrolling.macros
97
+ - ext/sha3/Optimized64/SnP-interface.h
98
+ - ext/sha3/Reference/KeccakF-1600-reference.c
99
+ - ext/sha3/Reference/KeccakF-reference.h
100
+ - ext/sha3/Reference/SnP-FBWL-default.c
101
+ - ext/sha3/Reference/SnP-FBWL-default.h
102
+ - ext/sha3/Reference/SnP-interface.h
103
+ - ext/sha3/Reference/displayIntermediateValues.c
104
+ - ext/sha3/Reference/displayIntermediateValues.h
105
+ - ext/sha3/SnP-Relaned.h
108
106
  - ext/sha3/brg_endian.h
109
107
  - ext/sha3/digest.c
110
108
  - ext/sha3/digest.h
111
- - ext/sha3/displayIntermediateValues.c
112
- - ext/sha3/displayIntermediateValues.h
113
109
  - ext/sha3/extconf.rb
114
110
  - ext/sha3/sha3.c
115
111
  - ext/sha3/sha3.h
@@ -125,24 +121,23 @@ homepage: https://github.com/johanns/sha3#readme
125
121
  licenses:
126
122
  - MIT
127
123
  metadata: {}
128
- post_install_message:
124
+ post_install_message:
129
125
  rdoc_options: []
130
126
  require_paths:
131
127
  - lib
132
128
  required_ruby_version: !ruby/object:Gem::Requirement
133
129
  requirements:
134
- - - '>='
130
+ - - ">="
135
131
  - !ruby/object:Gem::Version
136
132
  version: '0'
137
133
  required_rubygems_version: !ruby/object:Gem::Requirement
138
134
  requirements:
139
- - - '>='
135
+ - - ">="
140
136
  - !ruby/object:Gem::Version
141
137
  version: '0'
142
138
  requirements: []
143
- rubyforge_project:
144
- rubygems_version: 2.0.2
145
- signing_key:
139
+ rubygems_version: 3.2.22
140
+ signing_key:
146
141
  specification_version: 4
147
142
  summary: SHA3 for Ruby
148
143
  test_files:
data/README.rdoc DELETED
@@ -1,132 +0,0 @@
1
- = sha3 {<img src="https://secure.travis-ci.org/johanns/sha3.png" alt="Build Status" />}[http://travis-ci.org/johanns/sha3] {<img src="https://gemnasium.com/johanns/sha3.png" alt="Dependency Status" />}[https://gemnasium.com/johanns/sha3]
2
-
3
- <em>SHA3 for Ruby</em> is a native (C) implementation of Keccak (SHA3) cryptographic hashing algorithm.
4
-
5
- Home :: https://github.com/johanns/sha3#readme
6
- Issues :: https://github.com/johanns/sha3/issues
7
- Documentation :: http://rubydoc.info/gems/sha3/frames
8
-
9
- == Module details
10
-
11
- <em>SHA3::Digest</em>: A standard *Digest* _subclass_. The interface, and operation of this class are parallel to digest classes bundled with MRI-based Rubies (e.g.: <em>Digest::SHA2</em>, and <em>OpenSSL::Digest</em>). See *Digest* documentation for additional details (http://www.ruby-doc.org/stdlib-1.9.3/libdoc/digest/rdoc/Digest.html).
12
-
13
- <em>SHA3::Digest.compute()</em>: A class-method with data bit-length hashing support.
14
-
15
- == Installation
16
-
17
- gem install sha3
18
-
19
- == Usage
20
-
21
- require 'sha3'
22
-
23
- Valid hash bit-lengths are: *224*, *256*, *384*, *512*. You may also use corresponding symbols when instantiating a new instance or calling the <em>SHA3::Digest.compute()</em> method:
24
-
25
- :sha224 :sha256 :sha384 :sha512
26
-
27
- # SHA3::Digest.new(224) is SHA3::Digest.new(:sha224)
28
-
29
- Alternatively, you can instantiate using one of four sub-classes:
30
-
31
- SHA3::Digest::SHA224.new() # 224 bits
32
- SHA3::Digest::SHA256.new() # 256 bits
33
- SHA3::Digest::SHA384.new() # 384 bits
34
- SHA3::Digest::SHA512.new() # 512 bits
35
-
36
- === Basics
37
-
38
- # Instantiate a new SHA3::Digest class with 256 bit length
39
- s = SHA3::Digest.new(:sha256)
40
-
41
- # OR #
42
-
43
- s = SHA3::Digest::SHA256.new()
44
-
45
- # Update hash state, and compute new value
46
- s.update "Compute Me"
47
-
48
- # << is an .update() alias
49
- s << "Me too"
50
-
51
- # Returns digest value in bytes
52
- s.digest
53
- # => "\xBE\xDF\r\xD9\xA1..."
54
-
55
- # Returns digest value as hex string
56
- s.hexdigest
57
- # => "bedf0dd9a15b647..."
58
-
59
- ### Digest class-methods: ###
60
-
61
- SHA3::Digest.hexdigest("Hash me, please", :sha224)
62
- # => "200e7bc18cd613..."
63
-
64
- SHA3::Digest::SHA384.digest("Hash me, please")
65
- # => "\xF5\xCEpC\xB0eV..."
66
-
67
- === Hashing a file
68
-
69
- # Compute the hash value for given file, and return the result as hex
70
- s = SHA3::Digest::SHA224.file("my_fantastical_file.bin").hexdigest
71
-
72
- # Calling SHA3::Digest.file(...) defaults to SHA256
73
- s = SHA3::Digest.file("tests.sh")
74
- # => #<SHA3::Digest: a9801db49389339...>
75
-
76
- === Bit-length hashing
77
-
78
- # Compute hash of "011"
79
- SHA3::Digest.compute(:sha224, "\xC0", 3).unpack("H*")
80
- # => ["2b695a6fd92a..."]
81
-
82
- == Development
83
-
84
- * Native build tools (e.g., GCC, Minigw, etc.)
85
- * Gems: rubygems-tasks, rake, rspec, yard
86
-
87
- == Testing + RSpec
88
-
89
- Call +rake+ to run the included RSpec tests.
90
-
91
- 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 bit-length RSpec test files.
92
-
93
- sh tests.sh
94
-
95
- == Rubies
96
-
97
- Tested with Rubies:
98
-
99
- - MRI 2.0.0
100
- - MRI 1.9.3
101
- - MRI 1.9.2
102
- - MRI 1.8.7
103
- - MRI Ruby-Head
104
- - Rubinius (18mode)
105
- - Rubinius (19mode)
106
- - ree
107
-
108
- On:
109
-
110
- - Ubuntu 12.04, 12.10, 13.04
111
- - Windows 7, 8
112
- - Mac OS X 10.8
113
-
114
- == Releases
115
-
116
- *0.1.x* :: Alpha code, and not suitable for production.
117
- *0.2.0* :: Production worthy, but breaks API compatibility with 0.1.x. Backward-compatibility will be maintained henceforth.
118
- *0.2.2* :: Added sub-class for each SHA3 supported bit-lengths (example: SHA3::Digest::SHA256). Minor bug fix.
119
- *0.2.3* :: Added documentation file (decoupled form C source); refactored C source.
120
- *0.2.4* :: Bug fixes. (YANKED)
121
- *0.2.5* :: Bug fixes. (See ChangeLog.rdoc)
122
-
123
- == TO DO:
124
-
125
- * Add support for arbitrary length hashes.
126
- * Add hex output support to compute method.
127
-
128
- == Copyright
129
-
130
- Copyright (c) 2012 - 2013 Johanns Gregorian (https://github.com/johanns)
131
-
132
- See LICENSE.txt for details.