sha3 0.2.6 → 1.0.1

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +9 -1
  4. data/Gemfile.ci +4 -4
  5. data/LICENSE.txt +1 -1
  6. data/README.md +145 -0
  7. data/Rakefile +4 -5
  8. data/ext/sha3/KeccakF-1600-interface.h +28 -34
  9. data/ext/sha3/KeccakHash.c +80 -0
  10. data/ext/sha3/KeccakHash.h +110 -0
  11. data/ext/sha3/KeccakSponge.c +127 -201
  12. data/ext/sha3/KeccakSponge.h +74 -37
  13. data/ext/sha3/Optimized64/KeccakF-1600-64.macros +2199 -0
  14. data/ext/sha3/Optimized64/KeccakF-1600-opt64-settings.h +3 -0
  15. data/ext/sha3/Optimized64/KeccakF-1600-opt64.c +508 -0
  16. data/ext/sha3/{KeccakF-1600-unrolling.macros → Optimized64/KeccakF-1600-unrolling.macros} +16 -14
  17. data/ext/sha3/Optimized64/SnP-interface.h +47 -0
  18. data/ext/sha3/Reference/KeccakF-1600-reference.c +311 -0
  19. data/ext/sha3/Reference/KeccakF-reference.h +26 -0
  20. data/ext/sha3/Reference/SnP-FBWL-default.c +96 -0
  21. data/ext/sha3/Reference/SnP-FBWL-default.h +26 -0
  22. data/ext/sha3/Reference/SnP-interface.h +42 -0
  23. data/ext/sha3/{displayIntermediateValues.c → Reference/displayIntermediateValues.c} +52 -11
  24. data/ext/sha3/{displayIntermediateValues.h → Reference/displayIntermediateValues.h} +11 -6
  25. data/ext/sha3/SnP-Relaned.h +249 -0
  26. data/ext/sha3/brg_endian.h +0 -0
  27. data/ext/sha3/digest.c +67 -70
  28. data/ext/sha3/digest.h +2 -2
  29. data/ext/sha3/extconf.rb +7 -12
  30. data/ext/sha3/sha3.h +2 -2
  31. data/lib/sha3/doc.rb +26 -39
  32. data/lib/sha3/version.rb +2 -2
  33. data/sha3.gemspec +6 -6
  34. data/spec/generate_tests.rb +6 -41
  35. data/spec/sha3_core_spec.rb +111 -133
  36. data/spec/spec_helper.rb +2 -2
  37. data/tests.sh +9 -7
  38. metadata +33 -36
  39. data/README.rdoc +0 -131
  40. data/ext/sha3/KeccakF-1600-32-rvk.macros +0 -555
  41. data/ext/sha3/KeccakF-1600-32-s1.macros +0 -1187
  42. data/ext/sha3/KeccakF-1600-32-s2.macros +0 -1187
  43. data/ext/sha3/KeccakF-1600-32.macros +0 -26
  44. data/ext/sha3/KeccakF-1600-64.macros +0 -728
  45. data/ext/sha3/KeccakF-1600-int-set.h +0 -6
  46. data/ext/sha3/KeccakF-1600-opt.c +0 -504
  47. data/ext/sha3/KeccakF-1600-opt32-settings.h +0 -4
  48. data/ext/sha3/KeccakF-1600-opt32.c-arch +0 -524
  49. data/ext/sha3/KeccakF-1600-opt64-settings.h +0 -7
  50. data/ext/sha3/KeccakF-1600-opt64.c-arch +0 -504
  51. data/ext/sha3/KeccakF-1600-reference.c-arch +0 -300
  52. data/ext/sha3/KeccakF-1600-x86-64-gas.s +0 -766
  53. data/ext/sha3/KeccakF-1600-x86-64-shld-gas.s +0 -766
  54. data/ext/sha3/KeccakNISTInterface.c +0 -81
  55. data/ext/sha3/KeccakNISTInterface.h +0 -70
@@ -2,9 +2,9 @@ module SHA3
2
2
  extend self
3
3
 
4
4
  # sha3 release version
5
- VERSION = "0.2.6"
5
+ VERSION = "1.0.1"
6
6
 
7
7
  # keccak version number
8
- KECCAK_VERSION = "3.2"
8
+ KECCAK_VERSION = "4.0"
9
9
  end
10
10
 
@@ -6,10 +6,10 @@ Gem::Specification.new do |gem|
6
6
  gem.name = "sha3"
7
7
  gem.version = SHA3::VERSION
8
8
  gem.summary = %q{SHA3 for Ruby}
9
- gem.description = %q{SHA3 for Ruby is a native (C) implementation of Keccak (SHA3) cryptographic hashing algorithm.}
9
+ gem.description = %q{SHA3 for Ruby is a native (C) FIPS 202 compliant implementation of SHA3 (Keccak) cryptographic hashing algorithm.}
10
10
  gem.license = "MIT"
11
11
  gem.authors = ["Johanns Gregorian"]
12
- gem.email = "io+sha3@jsani.com"
12
+ gem.email = "io+sha3@jsg.io"
13
13
  gem.homepage = "https://github.com/johanns/sha3#readme"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ['lib']
19
19
  gem.extensions = ['ext/sha3/extconf.rb']
20
-
20
+
21
21
  gem.add_development_dependency "rake-compiler"
22
- gem.add_development_dependency 'rspec', '~> 2.4'
23
- gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
24
- gem.add_development_dependency 'yard', '~> 0.8'
22
+ gem.add_development_dependency 'rspec', '~> 3.3'
23
+ gem.add_development_dependency 'rubygems-tasks'
24
+ gem.add_development_dependency 'yard'
25
25
  end
@@ -1,11 +1,10 @@
1
1
  # Based on python-sha3's / digest-sha3 test generator.
2
2
 
3
3
  FILES = [
4
- ['data/ShortMsgKAT_224.txt', 224],
5
- ['data/ShortMsgKAT_256.txt', 256],
6
- ['data/ShortMsgKAT_384.txt', 384],
7
- ['data/ShortMsgKAT_512.txt', 512],
8
- ['data/LongMsgKAT_224.txt', 224],
4
+ ['data/ShortMsgKAT_SHA3-224.txt', 224],
5
+ ['data/ShortMsgKAT_SHA3-256.txt', 256],
6
+ ['data/ShortMsgKAT_SHA3-384.txt', 384],
7
+ ['data/ShortMsgKAT_SHA3-512.txt', 512],
9
8
  ]
10
9
 
11
10
  def gen_digest_byte_tests
@@ -29,41 +28,7 @@ describe "SHA3::Digest.new(#{hashlen})" do
29
28
  msg_raw = [lines[1].split(' = ').last].pack("H*")
30
29
  md = lines[2].split(' = ').last.downcase
31
30
  f.puts(
32
- %Q{ SHA3::Digest.new(#{hashlen}, #{msg_raw.inspect}).hexdigest.should(eq("#{md}"))
33
- })
34
- end
35
- end
36
- end
37
- f.puts(
38
- %Q{ end
39
- end
40
- })
41
- f.close
42
- end
43
- end
44
-
45
- def gen_compute_bit_tests
46
- FILES.each do |path, hashlen|
47
- name = File.basename(path).split('.')[0]
48
-
49
- f = File.new("sha3_compute_#{name}_spec.rb", "w")
50
- f.puts(
51
- %Q{require 'spec_helper'
52
- require 'sha3'
53
-
54
- describe "SHA3::Digest.compute(#{hashlen})" do
55
- it "should match bit-length test vectors (#{name})." do
56
- })
57
- contents = File.read(path).split('Len = ')
58
- contents.each do |test|
59
- lines = test.split("\n")
60
- if !lines.empty? && lines[0] !~ /^#/
61
- length = lines[0].to_i
62
- if length != 0
63
- msg_raw = [lines[1].split(' = ').last].pack("H*")
64
- md = lines[2].split(' = ').last.downcase
65
- f.puts(
66
- %Q{ SHA3::Digest.compute(#{hashlen}, #{msg_raw.inspect}, #{length}).unpack("H*").first.should(eq("#{md}"))
31
+ %Q{ expect(SHA3::Digest.new(#{hashlen}, #{msg_raw.inspect}).hexdigest).to eq("#{md}")
67
32
  })
68
33
  end
69
34
  end
@@ -77,7 +42,7 @@ end
77
42
  end
78
43
 
79
44
  def setup
80
-
45
+
81
46
  end
82
47
 
83
48
  gen_digest_byte_tests
@@ -1,170 +1,148 @@
1
1
  require 'spec_helper'
2
2
  require 'sha3'
3
3
 
4
- describe SHA3 do
5
- it "should have a VERSION constant" do
6
- subject.const_get('VERSION').should_not be_empty
4
+ RSpec.describe SHA3 do
5
+ it 'should have a VERSION constant' do
6
+ expect(subject.const_get('VERSION')).not_to be_empty
7
7
  end
8
8
 
9
- it "should have a KECCAK_VERSION constant" do
10
- subject.const_get('KECCAK_VERSION').should_not be_empty
9
+ it 'should have a KECCAK_VERSION constant' do
10
+ expect(subject.const_get('KECCAK_VERSION')).not_to be_empty
11
11
  end
12
12
 
13
- it "should have Digest class" do
14
- subject.const_get('Digest').is_a?(Class).should be_true
15
- end
13
+ it 'should have Digest class' do
14
+ expect(subject.const_get('Digest').is_a?(Class)).to be_truthy
15
+ end
16
16
  end
17
17
 
18
- describe SHA3::Digest do
19
- it "should pass Digest.new() (default: :sha256) usage test" do
18
+ RSpec.describe SHA3::Digest do
19
+ it 'should pass Digest.new() (default: :sha256) usage test' do
20
20
  sha = SHA3::Digest.new()
21
- sha.hexdigest.should eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
22
- sha.update(["cc"].pack("H*")).hexdigest.should eq("eead6dbfc7340a56caedc044696a168870549a6a7f6f56961e84a54bd9970b8a")
23
- sha.reset.hexdigest.should eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
24
- sha << (["6172f1971a6e1e4e6170afbad95d5fec99bf69b24b674bc17dd78011615e502de6f56b86b1a71d3f4348087218ac7b7d09302993be272e4a591968aef18a1262d665610d1070ee91cc8da36e1f841a69a7a682c580e836941d21d909a3afc1f0b963e1ca5ab193e124a1a53df1c587470e5881fb54dae1b0d840f0c8f9d1b04c645ba1041c7d8dbf22030a623aa15638b3d99a2c400ff76f3252079af88d2b37f35ee66c1ad7801a28d3d388ac450b97d5f0f79e4541755356b3b1a5696b023f39ab7ab5f28df4202936bc97393b93bc915cb159ea1bd7a0a414cb4b7a1ac3af68f50d79f0c9c7314e750f7d02faa58bfa"].pack("H*"))
25
- sha.hexdigest.should(eq("4ea524e705020284b18284e34683725590e1ee565a6ff598ed4d42b1c987471e"))
26
- sha.digest_length.should(eq(32))
27
- sha.block_length.should(eq(136))
21
+
22
+ expect(sha.hexdigest).to eq('a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
23
+ expect(sha.update(['cc'].pack('H*'))).to eq('677035391cd3701293d385f037ba32796252bb7ce180b00b582dd9b20aaad7f0')
24
+ expect(sha.reset).to eq('a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
25
+
26
+ sha << (['6172f1971a6e1e4e6170afbad95d5fec99bf69b24b674bc17dd78011615e502de6f56b86b1a71d3f4348087218ac7b7d09302993be272e4a591968aef18a1262d665610d1070ee91cc8da36e1f841a69a7a682c580e836941d21d909a3afc1f0b963e1ca5ab193e124a1a53df1c587470e5881fb54dae1b0d840f0c8f9d1b04c645ba1041c7d8dbf22030a623aa15638b3d99a2c400ff76f3252079af88d2b37f35ee66c1ad7801a28d3d388ac450b97d5f0f79e4541755356b3b1a5696b023f39ab7ab5f28df4202936bc97393b93bc915cb159ea1bd7a0a414cb4b7a1ac3af68f50d79f0c9c7314e750f7d02faa58bfa'].pack('H*'))
27
+
28
+ expect(sha.hexdigest).to eq('f60c53ba2132293b881f0513e7ab47fe9746ed4a6ac9cade61e6d802d5872372')
29
+ expect(sha.digest_length).to eq(32)
30
+ expect(sha.block_length).to eq(136)
28
31
  end
29
32
 
30
- it "should pass Digest.new(:sha224) usage test" do
33
+ it 'should pass Digest.new(:sha224) usage test' do
31
34
  sha = SHA3::Digest.new(:sha224)
32
- sha.hexdigest.should eq("f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd")
33
- sha.update(["cc"].pack("H*")).hexdigest.should eq("a9cab59eb40a10b246290f2d6086e32e3689faf1d26b470c899f2802")
34
- sha.reset.hexdigest.should eq("f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd")
35
- sha << (["5fce8109a358570e40983e1184e541833bb9091e280f258cfb144387b05d190e431cb19baa67273ba0c58abe91308e1844dcd0b3678baa42f335f2fa05267a0240b3c718a5942b3b3e3bfa98a55c25a1466e8d7a603722cb2bbf03afa54cd769a99f310735ee5a05dae2c22d397bd95635f58c48a67f90e1b73aafcd3f82117f0166657838691005b18da6f341d6e90fc1cdb352b30fae45d348294e501b63252de14740f2b85ae5299ddec3172de8b6d0ba219a20a23bb5e10ff434d39db3f583305e9f5c039d98569e377b75a70ab837d1df269b8a4b566f40bb91b577455fd3c356c914fa06b9a7ce24c7317a172d"].pack("H*"))
36
- sha.hexdigest.should(eq("db85af5cfce746240e6d44e73cef66a72ce5968284d35ffef7fbff6c"))
37
- sha.digest_length.should(eq(28))
38
- sha.block_length.should(eq(144))
35
+
36
+ expect(sha.hexdigest).to eq('6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7')
37
+ expect(sha.update(['cc'].pack('H*'))).to eq('df70adc49b2e76eee3a6931b93fa41841c3af2cdf5b32a18b5478c39')
38
+ expect(sha.reset).to eq('6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7')
39
+
40
+ sha << (['5fce8109a358570e40983e1184e541833bb9091e280f258cfb144387b05d190e431cb19baa67273ba0c58abe91308e1844dcd0b3678baa42f335f2fa05267a0240b3c718a5942b3b3e3bfa98a55c25a1466e8d7a603722cb2bbf03afa54cd769a99f310735ee5a05dae2c22d397bd95635f58c48a67f90e1b73aafcd3f82117f0166657838691005b18da6f341d6e90fc1cdb352b30fae45d348294e501b63252de14740f2b85ae5299ddec3172de8b6d0ba219a20a23bb5e10ff434d39db3f583305e9f5c039d98569e377b75a70ab837d1df269b8a4b566f40bb91b577455fd3c356c914fa06b9a7ce24c7317a172d'].pack('H*'))
41
+
42
+ expect(sha.hexdigest).to eq('2ebe13f12ec43e3f6b0506d7ab216e1c311394f7c89d69a920cd00c0')
43
+ expect(sha.digest_length).to eq(28)
44
+ expect(sha.block_length).to eq(144)
39
45
  end
40
46
 
41
- it "should pass Digest.new(:sha256) usage test" do
47
+ it 'should pass Digest.new(:sha256) usage test' do
42
48
  sha = SHA3::Digest.new(:sha256)
43
- sha.hexdigest.should eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
44
- sha.update(["cc"].pack("H*")).hexdigest.should eq("eead6dbfc7340a56caedc044696a168870549a6a7f6f56961e84a54bd9970b8a")
45
- sha.reset.hexdigest.should eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
46
- sha << (["6172f1971a6e1e4e6170afbad95d5fec99bf69b24b674bc17dd78011615e502de6f56b86b1a71d3f4348087218ac7b7d09302993be272e4a591968aef18a1262d665610d1070ee91cc8da36e1f841a69a7a682c580e836941d21d909a3afc1f0b963e1ca5ab193e124a1a53df1c587470e5881fb54dae1b0d840f0c8f9d1b04c645ba1041c7d8dbf22030a623aa15638b3d99a2c400ff76f3252079af88d2b37f35ee66c1ad7801a28d3d388ac450b97d5f0f79e4541755356b3b1a5696b023f39ab7ab5f28df4202936bc97393b93bc915cb159ea1bd7a0a414cb4b7a1ac3af68f50d79f0c9c7314e750f7d02faa58bfa"].pack("H*"))
47
- sha.hexdigest.should(eq("4ea524e705020284b18284e34683725590e1ee565a6ff598ed4d42b1c987471e"))
48
- sha.digest_length.should(eq(32))
49
- sha.block_length.should(eq(136))
49
+
50
+ expect(sha.hexdigest).to eq('a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
51
+ expect(sha.update(['cc'].pack('H*'))).to eq('677035391cd3701293d385f037ba32796252bb7ce180b00b582dd9b20aaad7f0')
52
+ expect(sha.reset).to eq('a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
53
+
54
+ sha << (['6172f1971a6e1e4e6170afbad95d5fec99bf69b24b674bc17dd78011615e502de6f56b86b1a71d3f4348087218ac7b7d09302993be272e4a591968aef18a1262d665610d1070ee91cc8da36e1f841a69a7a682c580e836941d21d909a3afc1f0b963e1ca5ab193e124a1a53df1c587470e5881fb54dae1b0d840f0c8f9d1b04c645ba1041c7d8dbf22030a623aa15638b3d99a2c400ff76f3252079af88d2b37f35ee66c1ad7801a28d3d388ac450b97d5f0f79e4541755356b3b1a5696b023f39ab7ab5f28df4202936bc97393b93bc915cb159ea1bd7a0a414cb4b7a1ac3af68f50d79f0c9c7314e750f7d02faa58bfa'].pack('H*'))
55
+
56
+ expect(sha.hexdigest).to eq('f60c53ba2132293b881f0513e7ab47fe9746ed4a6ac9cade61e6d802d5872372')
57
+ expect(sha.digest_length).to eq(32)
58
+ expect(sha.block_length).to eq(136)
50
59
  end
51
-
52
- it "should pass Digest.new(:sha384) usage test" do
60
+
61
+ it 'should pass Digest.new(:sha384) usage test' do
53
62
  sha = SHA3::Digest.new(:sha384)
54
- sha.hexdigest.should eq("2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff")
55
- sha.update(["cc"].pack("H*")).hexdigest.should eq("1b84e62a46e5a201861754af5dc95c4a1a69caf4a796ae405680161e29572641f5fa1e8641d7958336ee7b11c58f73e9")
56
- sha.reset.hexdigest.should eq("2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff")
57
- sha << (["3b8e97c5ffc2d6a40fa7de7fcefc90f3b12c940e7ab415321e29ee692dfac799b009c99dcddb708fce5a178c5c35ee2b8617143edc4c40b4d313661f49abdd93cea79d117518805496fe6acf292c4c2a1f76b403a97d7c399daf85b46ad84e16246c67d6836757bde336c290d5d401e6c1386ab32797af6bb251e9b2d8fe754c47482b72e0b394eab76916126fd68ea7d65eb93d59f5b4c5ac40f7c3b37e7f3694f29424c24af8c8f0ef59cd9dbf1d28e0e10f799a6f78cad1d45b9db3d7dee4a7059abe99182714983b9c9d44d7f5643596d4f3"].pack("H*"))
58
- sha.hexdigest.should(eq("9172aad6c15b4dcd79bbd84fad0601119d8b4e3afed17b594ff38424157985ee27b65826b9905486e767e85aa031e07b"))
59
- sha.digest_length.should(eq(48))
60
- sha.block_length.should(eq(104))
63
+
64
+ expect(sha.hexdigest).to eq('0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004')
65
+
66
+ expect(sha.update(['cc'].pack('H*'))).to eq('5ee7f374973cd4bb3dc41e3081346798497ff6e36cb9352281dfe07d07fc530ca9ad8ef7aad56ef5d41be83d5e543807')
67
+ expect(sha.reset).to eq('0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004')
68
+
69
+ sha << (['3b8e97c5ffc2d6a40fa7de7fcefc90f3b12c940e7ab415321e29ee692dfac799b009c99dcddb708fce5a178c5c35ee2b8617143edc4c40b4d313661f49abdd93cea79d117518805496fe6acf292c4c2a1f76b403a97d7c399daf85b46ad84e16246c67d6836757bde336c290d5d401e6c1386ab32797af6bb251e9b2d8fe754c47482b72e0b394eab76916126fd68ea7d65eb93d59f5b4c5ac40f7c3b37e7f3694f29424c24af8c8f0ef59cd9dbf1d28e0e10f799a6f78cad1d45b9db3d7dee4a7059abe99182714983b9c9d44d7f5643596d4f3'].pack('H*'))
70
+
71
+ expect(sha.hexdigest).to eq('9b809198dcce24175e33098331d3a402a821ae9326e72775aae34d1a9bb53d2b57863905cfd60543bbc42b454007c315')
72
+ expect(sha.digest_length).to eq(48)
73
+ expect(sha.block_length).to eq(104)
61
74
  end
62
75
 
63
- it "should pass Digest.new(:sha512) usage test" do
76
+ it 'should pass Digest.new(:sha512) usage test' do
64
77
  sha = SHA3::Digest.new(:sha512)
65
- sha.hexdigest.should eq("0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e")
66
- sha.update(["cc"].pack("H*")).hexdigest.should eq("8630c13cbd066ea74bbe7fe468fec1dee10edc1254fb4c1b7c5fd69b646e44160b8ce01d05a0908ca790dfb080f4b513bc3b6225ece7a810371441a5ac666eb9")
67
- sha.reset.hexdigest.should eq("0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e")
68
- sha << (["03d625488354df30e3f875a68edfcf340e8366a8e1ab67f9d5c5486a96829dfac0578289082b2a62117e1cf418b43b90e0adc881fc6ae8105c888e9ecd21aea1c9ae1a4038dfd17378fed71d02ae492087d7cdcd98f746855227967cb1ab4714261ee3bead3f4db118329d3ebef4bc48a875c19ba763966da0ebea800e01b2f50b00e9dd4caca6dcb314d00184ef71ea2391d760c950710db4a70f9212ffc54861f9dc752ce18867b8ad0c48df8466ef7231e7ac567f0eb55099e622ebb86cb237520190a61c66ad34f1f4e289cb3282ae3eaac6152ed24d2c92bae5a7658252a53c49b7b02dfe54fdb2e90074b6cf310ac661"].pack("H*"))
69
- sha.hexdigest.should(eq("13a592b73ede487036c8816bd6fc6cdc04dc6133409a6ee990584160518f9ef573264cf04d38a3ba75d150f4f026f6df8936e13c8f4f3ecc9ecbc43fdfc488a4"))
70
- sha.digest_length.should(eq(64))
71
- sha.block_length.should(eq(72))
78
+
79
+ expect(sha.hexdigest).to eq('a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26')
80
+ expect(sha.update(['cc'].pack('H*'))).to eq('3939fcc8b57b63612542da31a834e5dcc36e2ee0f652ac72e02624fa2e5adeecc7dd6bb3580224b4d6138706fc6e80597b528051230b00621cc2b22999eaa205')
81
+ expect(sha.reset).to eq('a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26')
82
+
83
+ sha << (['03d625488354df30e3f875a68edfcf340e8366a8e1ab67f9d5c5486a96829dfac0578289082b2a62117e1cf418b43b90e0adc881fc6ae8105c888e9ecd21aea1c9ae1a4038dfd17378fed71d02ae492087d7cdcd98f746855227967cb1ab4714261ee3bead3f4db118329d3ebef4bc48a875c19ba763966da0ebea800e01b2f50b00e9dd4caca6dcb314d00184ef71ea2391d760c950710db4a70f9212ffc54861f9dc752ce18867b8ad0c48df8466ef7231e7ac567f0eb55099e622ebb86cb237520190a61c66ad34f1f4e289cb3282ae3eaac6152ed24d2c92bae5a7658252a53c49b7b02dfe54fdb2e90074b6cf310ac661'].pack('H*'))
84
+
85
+ expect(sha.hexdigest).to eq('1fcd1e38ab03c750366cf86dd72ec3bf22f5bbf7fea0149d31b6a67b68b537b59ba37917fd88ced9aa8d2941a65f552b7928b3785c66d640f3b74af039ed18ce')
86
+ expect(sha.digest_length).to eq(64)
87
+ expect(sha.block_length).to eq(72)
72
88
  end
73
89
  end
74
90
 
75
- describe "SHA3::Digest::SHAxyz" do
76
- it "should pass Digest.SHA224() usage test" do
91
+ RSpec.describe 'SHA3::Digest::SHAxyz' do
92
+ it 'should pass Digest.SHA224() usage test' do
77
93
  sha = SHA3::Digest::SHA224.new()
78
- sha.hexdigest.should eq("f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd")
79
- sha.update(["cc"].pack("H*")).hexdigest.should eq("a9cab59eb40a10b246290f2d6086e32e3689faf1d26b470c899f2802")
80
- sha.reset.hexdigest.should eq("f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd")
81
- sha << (["5fce8109a358570e40983e1184e541833bb9091e280f258cfb144387b05d190e431cb19baa67273ba0c58abe91308e1844dcd0b3678baa42f335f2fa05267a0240b3c718a5942b3b3e3bfa98a55c25a1466e8d7a603722cb2bbf03afa54cd769a99f310735ee5a05dae2c22d397bd95635f58c48a67f90e1b73aafcd3f82117f0166657838691005b18da6f341d6e90fc1cdb352b30fae45d348294e501b63252de14740f2b85ae5299ddec3172de8b6d0ba219a20a23bb5e10ff434d39db3f583305e9f5c039d98569e377b75a70ab837d1df269b8a4b566f40bb91b577455fd3c356c914fa06b9a7ce24c7317a172d"].pack("H*"))
82
- sha.hexdigest.should(eq("db85af5cfce746240e6d44e73cef66a72ce5968284d35ffef7fbff6c"))
83
- sha.digest_length.should(eq(28))
84
- sha.block_length.should(eq(144))
94
+
95
+ expect(sha.hexdigest).to eq('6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7')
96
+ expect(sha.update(['cc'].pack('H*'))).to eq('df70adc49b2e76eee3a6931b93fa41841c3af2cdf5b32a18b5478c39')
97
+ expect(sha.reset).to eq('6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7')
98
+
99
+ sha << (['5fce8109a358570e40983e1184e541833bb9091e280f258cfb144387b05d190e431cb19baa67273ba0c58abe91308e1844dcd0b3678baa42f335f2fa05267a0240b3c718a5942b3b3e3bfa98a55c25a1466e8d7a603722cb2bbf03afa54cd769a99f310735ee5a05dae2c22d397bd95635f58c48a67f90e1b73aafcd3f82117f0166657838691005b18da6f341d6e90fc1cdb352b30fae45d348294e501b63252de14740f2b85ae5299ddec3172de8b6d0ba219a20a23bb5e10ff434d39db3f583305e9f5c039d98569e377b75a70ab837d1df269b8a4b566f40bb91b577455fd3c356c914fa06b9a7ce24c7317a172d'].pack("H*"))
100
+
101
+ expect(sha.hexdigest).to eq('2ebe13f12ec43e3f6b0506d7ab216e1c311394f7c89d69a920cd00c0')
102
+ expect(sha.digest_length).to eq(28)
103
+ expect(sha.block_length).to eq(144)
85
104
  end
86
105
 
87
- it "should pass Digest.SHA256() usage test" do
106
+ it 'should pass Digest.SHA256() usage test' do
88
107
  sha = SHA3::Digest::SHA256.new()
89
- sha.hexdigest.should eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
90
- sha.update(["cc"].pack("H*")).hexdigest.should eq("eead6dbfc7340a56caedc044696a168870549a6a7f6f56961e84a54bd9970b8a")
91
- sha.reset.hexdigest.should eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
92
- sha << (["6172f1971a6e1e4e6170afbad95d5fec99bf69b24b674bc17dd78011615e502de6f56b86b1a71d3f4348087218ac7b7d09302993be272e4a591968aef18a1262d665610d1070ee91cc8da36e1f841a69a7a682c580e836941d21d909a3afc1f0b963e1ca5ab193e124a1a53df1c587470e5881fb54dae1b0d840f0c8f9d1b04c645ba1041c7d8dbf22030a623aa15638b3d99a2c400ff76f3252079af88d2b37f35ee66c1ad7801a28d3d388ac450b97d5f0f79e4541755356b3b1a5696b023f39ab7ab5f28df4202936bc97393b93bc915cb159ea1bd7a0a414cb4b7a1ac3af68f50d79f0c9c7314e750f7d02faa58bfa"].pack("H*"))
93
- sha.hexdigest.should(eq("4ea524e705020284b18284e34683725590e1ee565a6ff598ed4d42b1c987471e"))
94
- sha.digest_length.should(eq(32))
95
- sha.block_length.should(eq(136))
108
+
109
+ expect(sha.hexdigest).to eq('a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
110
+ expect(sha.update(['cc'].pack('H*'))).to eq('677035391cd3701293d385f037ba32796252bb7ce180b00b582dd9b20aaad7f0')
111
+ expect(sha.reset).to eq('a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
112
+
113
+ sha << (['6172f1971a6e1e4e6170afbad95d5fec99bf69b24b674bc17dd78011615e502de6f56b86b1a71d3f4348087218ac7b7d09302993be272e4a591968aef18a1262d665610d1070ee91cc8da36e1f841a69a7a682c580e836941d21d909a3afc1f0b963e1ca5ab193e124a1a53df1c587470e5881fb54dae1b0d840f0c8f9d1b04c645ba1041c7d8dbf22030a623aa15638b3d99a2c400ff76f3252079af88d2b37f35ee66c1ad7801a28d3d388ac450b97d5f0f79e4541755356b3b1a5696b023f39ab7ab5f28df4202936bc97393b93bc915cb159ea1bd7a0a414cb4b7a1ac3af68f50d79f0c9c7314e750f7d02faa58bfa'].pack("H*"))
114
+
115
+ expect(sha.hexdigest).to eq('f60c53ba2132293b881f0513e7ab47fe9746ed4a6ac9cade61e6d802d5872372')
116
+ expect(sha.digest_length).to eq(32)
117
+ expect(sha.block_length).to eq(136)
96
118
  end
97
-
98
- it "should pass Digest.SHA384() usage test" do
119
+
120
+ it 'should pass Digest.SHA384() usage test' do
99
121
  sha = SHA3::Digest::SHA384.new()
100
- sha.hexdigest.should eq("2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff")
101
- sha.update(["cc"].pack("H*")).hexdigest.should eq("1b84e62a46e5a201861754af5dc95c4a1a69caf4a796ae405680161e29572641f5fa1e8641d7958336ee7b11c58f73e9")
102
- sha.reset.hexdigest.should eq("2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff")
103
- sha << (["3b8e97c5ffc2d6a40fa7de7fcefc90f3b12c940e7ab415321e29ee692dfac799b009c99dcddb708fce5a178c5c35ee2b8617143edc4c40b4d313661f49abdd93cea79d117518805496fe6acf292c4c2a1f76b403a97d7c399daf85b46ad84e16246c67d6836757bde336c290d5d401e6c1386ab32797af6bb251e9b2d8fe754c47482b72e0b394eab76916126fd68ea7d65eb93d59f5b4c5ac40f7c3b37e7f3694f29424c24af8c8f0ef59cd9dbf1d28e0e10f799a6f78cad1d45b9db3d7dee4a7059abe99182714983b9c9d44d7f5643596d4f3"].pack("H*"))
104
- sha.hexdigest.should(eq("9172aad6c15b4dcd79bbd84fad0601119d8b4e3afed17b594ff38424157985ee27b65826b9905486e767e85aa031e07b"))
105
- sha.digest_length.should(eq(48))
106
- sha.block_length.should(eq(104))
107
- end
108
122
 
109
- it "should pass Digest.SHA512() usage test" do
110
- sha = SHA3::Digest::SHA512.new()
111
- sha.hexdigest.should eq("0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e")
112
- sha.update(["cc"].pack("H*")).hexdigest.should eq("8630c13cbd066ea74bbe7fe468fec1dee10edc1254fb4c1b7c5fd69b646e44160b8ce01d05a0908ca790dfb080f4b513bc3b6225ece7a810371441a5ac666eb9")
113
- sha.reset.hexdigest.should eq("0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e")
114
- sha << (["03d625488354df30e3f875a68edfcf340e8366a8e1ab67f9d5c5486a96829dfac0578289082b2a62117e1cf418b43b90e0adc881fc6ae8105c888e9ecd21aea1c9ae1a4038dfd17378fed71d02ae492087d7cdcd98f746855227967cb1ab4714261ee3bead3f4db118329d3ebef4bc48a875c19ba763966da0ebea800e01b2f50b00e9dd4caca6dcb314d00184ef71ea2391d760c950710db4a70f9212ffc54861f9dc752ce18867b8ad0c48df8466ef7231e7ac567f0eb55099e622ebb86cb237520190a61c66ad34f1f4e289cb3282ae3eaac6152ed24d2c92bae5a7658252a53c49b7b02dfe54fdb2e90074b6cf310ac661"].pack("H*"))
115
- sha.hexdigest.should(eq("13a592b73ede487036c8816bd6fc6cdc04dc6133409a6ee990584160518f9ef573264cf04d38a3ba75d150f4f026f6df8936e13c8f4f3ecc9ecbc43fdfc488a4"))
116
- sha.digest_length.should(eq(64))
117
- sha.block_length.should(eq(72))
118
- end
123
+ expect(sha.hexdigest).to eq('0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004')
119
124
 
120
- end
125
+ expect(sha.update(['cc'].pack('H*'))).to eq('5ee7f374973cd4bb3dc41e3081346798497ff6e36cb9352281dfe07d07fc530ca9ad8ef7aad56ef5d41be83d5e543807')
126
+ expect(sha.reset).to eq('0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004')
121
127
 
122
- describe "SHA3::Digest.compute" do
123
- it "should match SHA3-224 test vectors (subset)" do
124
- SHA3::Digest.compute(:sha224, ["00"].pack("H*"), 0).unpack("H*").first.should(eq("f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd"))
125
- SHA3::Digest.compute(:sha224, ["00"].pack("H*"), 1).unpack("H*").first.should(eq("860e3ec314c5cbf19c1a4314e9ea8cb85cecd18bd850b42f5c6f2a07"))
126
- SHA3::Digest.compute(:sha224, ["c0"].pack("H*"), 2).unpack("H*").first.should(eq("6b22cddbd1366f7b8db2026aee8a0afa86b323aed7aa270ad928d1c5"))
127
- SHA3::Digest.compute(:sha224, ["c0"].pack("H*"), 3).unpack("H*").first.should(eq("2b695a6fd92a2b3f3ce9cfca617d22c9bb52815dd59a9719b01bad25"))
128
- SHA3::Digest.compute(:sha224, ["80"].pack("H*"), 4).unpack("H*").first.should(eq("bfa0740d2f2edcdee2db3f66f04fb8179967d3fb5981644d9d084bd7"))
129
- SHA3::Digest.compute(:sha224, ["48"].pack("H*"), 5).unpack("H*").first.should(eq("e4384016d64610d75e0a5d73821a02d524f847a25a571b5940cd6450"))
130
- SHA3::Digest.compute(:sha224, ["50"].pack("H*"), 6).unpack("H*").first.should(eq("a0fb02f1d41bc09cc4b3e85b15be85e3b3c2d43eb36dd616c640d7ca"))
131
- SHA3::Digest.compute(:sha224, ["98"].pack("H*"), 7).unpack("H*").first.should(eq("c00ecd3072762c82d08f8f76fecf38be23075f9c5663d06a9184bd0b"))
132
- SHA3::Digest.compute(:sha224, ["cc"].pack("H*"), 8).unpack("H*").first.should(eq("a9cab59eb40a10b246290f2d6086e32e3689faf1d26b470c899f2802"))
133
- end
134
-
135
- it "should match SHA3-256 test vectors (subset)" do
136
- SHA3::Digest.compute(:sha256, ["00"].pack("H*"), 0).unpack("H*").first.should(eq("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"))
137
- SHA3::Digest.compute(:sha256, ["00"].pack("H*"), 1).unpack("H*").first.should(eq("c3e5cb55999eeff4e07b7effec77582d0a5a11a94fc268a872493099273992e1"))
138
- SHA3::Digest.compute(:sha256, ["c0"].pack("H*"), 2).unpack("H*").first.should(eq("3a1108d4a90a31b85a10bdce77f4bfbdcc5b1d70dd405686f8bbde834aa1a410"))
139
- SHA3::Digest.compute(:sha256, ["c0"].pack("H*"), 3).unpack("H*").first.should(eq("7384d12118da4ad51a519806e2529fb2548b5dce2a87122b8507f71a28a35deb"))
140
- SHA3::Digest.compute(:sha256, ["80"].pack("H*"), 4).unpack("H*").first.should(eq("53e5e48805ae70306bf9ddc26e9ee2db87afe95ef0bfb9f9c44211be11a4c810"))
141
- SHA3::Digest.compute(:sha256, ["48"].pack("H*"), 5).unpack("H*").first.should(eq("c341f676da4d10d32d9dad5140d497fecfe9565c79f4f5aa7f1d3c36b290fe3b"))
142
- SHA3::Digest.compute(:sha256, ["50"].pack("H*"), 6).unpack("H*").first.should(eq("80b7ed96c53f37ebd0a0f2f7c63b0b35480f57215ab8c5fdf9f5f6e989a53366"))
143
- SHA3::Digest.compute(:sha256, ["98"].pack("H*"), 7).unpack("H*").first.should(eq("aca86ee608e0a6e31c0173f2eedee26c527f108f7f11a19a2e4327116485414c"))
144
- SHA3::Digest.compute(:sha256, ["cc"].pack("H*"), 8).unpack("H*").first.should(eq("eead6dbfc7340a56caedc044696a168870549a6a7f6f56961e84a54bd9970b8a"))
145
- end
128
+ sha << (['3b8e97c5ffc2d6a40fa7de7fcefc90f3b12c940e7ab415321e29ee692dfac799b009c99dcddb708fce5a178c5c35ee2b8617143edc4c40b4d313661f49abdd93cea79d117518805496fe6acf292c4c2a1f76b403a97d7c399daf85b46ad84e16246c67d6836757bde336c290d5d401e6c1386ab32797af6bb251e9b2d8fe754c47482b72e0b394eab76916126fd68ea7d65eb93d59f5b4c5ac40f7c3b37e7f3694f29424c24af8c8f0ef59cd9dbf1d28e0e10f799a6f78cad1d45b9db3d7dee4a7059abe99182714983b9c9d44d7f5643596d4f3'].pack("H*"))
146
129
 
147
- it "should match SHA3-384 test vectors (subset)" do
148
- SHA3::Digest.compute(:sha384, ["00"].pack("H*"), 0).unpack("H*").first.should(eq("2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff"))
149
- SHA3::Digest.compute(:sha384, ["00"].pack("H*"), 1).unpack("H*").first.should(eq("4c6d164043571a32e169a527ca3503ea391bf91f22287215df75ea243d53a0d042bc66efe2956d8606a24f39e255a081"))
150
- SHA3::Digest.compute(:sha384, ["c0"].pack("H*"), 2).unpack("H*").first.should(eq("c7058511440be5d4f5688ef721000e91244ad6d10fee477dccb84e8b84db897f51db533e49964b18e5e362e5fd569e19"))
151
- SHA3::Digest.compute(:sha384, ["c0"].pack("H*"), 3).unpack("H*").first.should(eq("3c297324d6f43be6a5b784c25b559910b6f79ef3c74db21575325cc9c917d935d8c3d6a9aa34f9fc65f1e9c39abc83ab"))
152
- SHA3::Digest.compute(:sha384, ["80"].pack("H*"), 4).unpack("H*").first.should(eq("b43af6ccf78fc5cab63eb7cda68fd89e95c506eea63c131a82f9d9a1798002bb40d3b78473c3a66456034720ba8142e2"))
153
- SHA3::Digest.compute(:sha384, ["48"].pack("H*"), 5).unpack("H*").first.should(eq("6877f31b109ebc6ddab14087739d7702f7e2aa2dd9d54b3b9c04749cb1adea194a52496dc78adcee84e705621f0564cc"))
154
- SHA3::Digest.compute(:sha384, ["50"].pack("H*"), 6).unpack("H*").first.should(eq("b7136d3ef3112a47c1c59c5fab6a40c6ecd7cc89e400dc2efae388dec1028985e138a2b2f54683a8814ef3c1ba28ea9c"))
155
- SHA3::Digest.compute(:sha384, ["98"].pack("H*"), 7).unpack("H*").first.should(eq("748de17dccb6b3fbaa1c938f5a3167244c83683105d45d429f0b40b31d9317860529ea54bfde1521423ceda9debd9d73"))
156
- SHA3::Digest.compute(:sha384, ["cc"].pack("H*"), 8).unpack("H*").first.should(eq("1b84e62a46e5a201861754af5dc95c4a1a69caf4a796ae405680161e29572641f5fa1e8641d7958336ee7b11c58f73e9"))
130
+ expect(sha.hexdigest).to eq('9b809198dcce24175e33098331d3a402a821ae9326e72775aae34d1a9bb53d2b57863905cfd60543bbc42b454007c315')
131
+ expect(sha.digest_length).to eq(48)
132
+ expect(sha.block_length).to eq(104)
157
133
  end
158
134
 
159
- it "should match SHA3-512 test vectors (subset)" do
160
- SHA3::Digest.compute(:sha512, ["00"].pack("H*"), 0).unpack("H*").first.should(eq("0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e"))
161
- SHA3::Digest.compute(:sha512, ["00"].pack("H*"), 1).unpack("H*").first.should(eq("7d9025bb145a0814083e934baa80ede67322651de52062bf9eb93623c37efc74c62240cf8539107f9210c1e1126f79cbaeda6b82b4a8ce6821589c403fa76b9a"))
162
- SHA3::Digest.compute(:sha512, ["c0"].pack("H*"), 2).unpack("H*").first.should(eq("0ae7dac687c3525d5c2a6c4119ea3968d43dfe69c2407a44d3de6b804d784530462440e4881fd42785e1cb69af4f036d96d8ff1ee35d9b3fa4a2859f592fb2dc"))
163
- SHA3::Digest.compute(:sha512, ["c0"].pack("H*"), 3).unpack("H*").first.should(eq("5a844de7d6b8be77bec55021c9bfa375c4b97d79633c7ea4e7e2bc4c64ac6349d3a0142aaa50c2118b1d94af9a5b804af94f259b2d06c3f4a4997afb8f787f6b"))
164
- SHA3::Digest.compute(:sha512, ["80"].pack("H*"), 4).unpack("H*").first.should(eq("b9f236b9c7ca24fe356e9375b34831b0054d4ab5cfb9e326c9e411c1805b3adb36e7d6ceccac123f27638fad3f34c48f8813a338cd53824d19bc14f6eac218b6"))
165
- SHA3::Digest.compute(:sha512, ["48"].pack("H*"), 5).unpack("H*").first.should(eq("88cd5e4ab2b5cc16cf48e87b1ee3ee1fc5b1ea98142e02346429e5c8f18b570120a04040cdab16643bfd70d31ab3fd6fc360955ab4f6a9494f4fdfaa9b6576b2"))
166
- SHA3::Digest.compute(:sha512, ["50"].pack("H*"), 6).unpack("H*").first.should(eq("5c69cfb002435d627390c62f2e7e74a688e537ea1dac71d97f6d99bccb64fda7d45a8e6b9dac199b78c4a3b59b04c8f1354b8d15b01db520932f1544dfbf757b"))
167
- SHA3::Digest.compute(:sha512, ["98"].pack("H*"), 7).unpack("H*").first.should(eq("90e09885b5f8b9192e8380522f96d6c1c6d407aa9b73cb07ad8b84c310f08adad507b63c2c041f00119062d63421ffb51e81d39db17a022730a03d6feecbcf0b"))
168
- SHA3::Digest.compute(:sha512, ["cc"].pack("H*"), 8).unpack("H*").first.should(eq("8630c13cbd066ea74bbe7fe468fec1dee10edc1254fb4c1b7c5fd69b646e44160b8ce01d05a0908ca790dfb080f4b513bc3b6225ece7a810371441a5ac666eb9"))
135
+ it 'should pass Digest.SHA512() usage test' do
136
+ sha = SHA3::Digest::SHA512.new()
137
+
138
+ expect(sha.hexdigest).to eq('a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26')
139
+ expect(sha.update(['cc'].pack('H*'))).to eq('3939fcc8b57b63612542da31a834e5dcc36e2ee0f652ac72e02624fa2e5adeecc7dd6bb3580224b4d6138706fc6e80597b528051230b00621cc2b22999eaa205')
140
+ expect(sha.reset).to eq('a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26')
141
+
142
+ sha << (['03d625488354df30e3f875a68edfcf340e8366a8e1ab67f9d5c5486a96829dfac0578289082b2a62117e1cf418b43b90e0adc881fc6ae8105c888e9ecd21aea1c9ae1a4038dfd17378fed71d02ae492087d7cdcd98f746855227967cb1ab4714261ee3bead3f4db118329d3ebef4bc48a875c19ba763966da0ebea800e01b2f50b00e9dd4caca6dcb314d00184ef71ea2391d760c950710db4a70f9212ffc54861f9dc752ce18867b8ad0c48df8466ef7231e7ac567f0eb55099e622ebb86cb237520190a61c66ad34f1f4e289cb3282ae3eaac6152ed24d2c92bae5a7658252a53c49b7b02dfe54fdb2e90074b6cf310ac661'].pack("H*"))
143
+
144
+ expect(sha.hexdigest).to eq('1fcd1e38ab03c750366cf86dd72ec3bf22f5bbf7fea0149d31b6a67b68b537b59ba37917fd88ced9aa8d2941a65f552b7928b3785c66d640f3b74af039ed18ce')
145
+ expect(sha.digest_length).to eq(64)
146
+ expect(sha.block_length).to eq(72)
169
147
  end
170
- end
148
+ end
@@ -1,4 +1,4 @@
1
- gem 'rspec', '~> 2.4'
1
+ gem 'rspec'
2
+
2
3
  require 'rspec'
3
4
  require 'sha3/version'
4
-
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
8
  rm -rfv spec/data/*
9
9
  else
10
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/gvanas/KeccakCodePackage/master/TestVectors/ShortMsgKAT_SHA3-224.txt"
21
+ wget "https://raw.githubusercontent.com/gvanas/KeccakCodePackage/master/TestVectors/ShortMsgKAT_SHA3-256.txt"
22
+ wget "https://raw.githubusercontent.com/gvanas/KeccakCodePackage/master/TestVectors/ShortMsgKAT_SHA3-384.txt"
23
+ wget "https://raw.githubusercontent.com/gvanas/KeccakCodePackage/master/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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sha3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johanns Gregorian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-02 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -30,45 +30,45 @@ dependencies:
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
- version: '0.2'
47
+ version: '0'
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
- version: '0.2'
54
+ version: '0'
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'
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'
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
@@ -83,33 +83,29 @@ files:
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
@@ -141,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
137
  version: '0'
142
138
  requirements: []
143
139
  rubyforge_project:
144
- rubygems_version: 2.4.5
140
+ rubygems_version: 2.2.2
145
141
  signing_key:
146
142
  specification_version: 4
147
143
  summary: SHA3 for Ruby
@@ -149,3 +145,4 @@ test_files:
149
145
  - spec/generate_tests.rb
150
146
  - spec/sha3_core_spec.rb
151
147
  - spec/spec_helper.rb
148
+ has_rdoc: