sha3-pure-ruby 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d1e1ee171f8a07eb5253aa3ed771a17d80c92f7
4
- data.tar.gz: 36736b4834b50f832b87622ad9ff29ec98c6ee7c
3
+ metadata.gz: 6222f3acb7e1fd8de4bda2388e10a63a29a278ee
4
+ data.tar.gz: 9c5fa4404737f31566eef9b30926f75e291fb2d1
5
5
  SHA512:
6
- metadata.gz: cef2c4abbbc1d3852c07c01238286e8da1d2c2375e02110cf075e858b0f02b71fc3b076994fe3d18d9d6c16e02b3ce3f612f8fb8483e1bed90cc7b1443c3e798
7
- data.tar.gz: 9b15e3d1217d816109498ca37e847d29865474151a3ebd0c48cc1546df5092ac28609437de53cdac0718bf8b0d9b1af63a12dbf94ce00860bf7ce6e16b0e3e93
6
+ metadata.gz: 555854cb001a2ba1683b60e858bd5a14a4d8a01b49364490bec92817cb738031b8a1bd4e8640b3483cb38d68707c0242c3c4e16aa1be3d725ccb1585477f6f4b
7
+ data.tar.gz: 99120487c7b33e36c595d382684eda30e41c289a88382e0c637a2688dc53332b3b1a9ea99dd1005df5e469e277d17b4710554830a201299a8b71fdbb2ac5e28d
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
+ Gemfile.lock
14
15
 
15
16
  # YARD artifacts
16
17
  .yardoc
@@ -1,7 +1,18 @@
1
1
  language: ruby
2
+
3
+ sudo: false
4
+
5
+ before_install: rvm get head
6
+
2
7
  rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- - 1.9.2
6
- - jruby-19mode
7
- - rbx-19mode
8
+ - 2.1.8
9
+ - 2.2.4
10
+ - 2.3.0
11
+ - ruby-head
12
+ - jruby-9.0.5.0
13
+ - jruby-head
14
+
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: ruby-head
18
+ - rvm: jruby-head
@@ -0,0 +1,3 @@
1
+ ### 1.0.0 / 2016-04-10
2
+
3
+ * Breaking change: update the reference implementation padding to comply with [FIPS 202](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) (@iagox86, @steakknife)
data/README.md CHANGED
@@ -17,23 +17,25 @@ Or execute `bundle` after adding this line to your app's Gemfile:
17
17
  gem 'sha3-pure-ruby'
18
18
  ```
19
19
 
20
- ## Usage
20
+ ## Usage Examples
21
21
 
22
22
  ```ruby
23
- Digest::SHA3.new.hexdigest 'default 512-bit'
24
- #=> "26dce8c3ea8e5ffbfbf684070ca59f9635487942bfc220b9fe94bf9b2f8a7dfa2e4e85059ead3c92f14e5d2e06076eb6643adf50481976bd52f737f89b185ae2"
23
+ Digest::SHA3.hexdigest 'default 512-bit'
24
+ #=> "561ac4ec3e6bc5d3bb8a19e440441d2482d94c3932896c11c62177d1bccd8d25022ba68b8b0344c0a3fac4af5c06a17ae4372b76653c2230bae5240cde92cc55"
25
+ ```
25
26
 
27
+ ```ruby
26
28
  Digest::SHA3.new(224).hexdigest 'example 224-bit'
27
- #=> "d6e8cef46de550a1b50ca920c4600a6e1512af055034c45a33849133"
29
+ #=> "89354196ffd570c33c70a37da19b55a9761a3ae178488ee1345b7fae"
30
+
31
+ Digest::SHA3.hexdigest 'another way', 224
32
+ #=> "2e250b541367f0f86bbc6f701fb2bcd8e85c159497805580eae989e1"
28
33
  ```
29
34
 
30
- ## Compatibility
35
+ ## C-Extension Alternatives
31
36
 
32
- - Ruby 2.0.0
33
- - Ruby 1.9.3
34
- - Ruby 1.9.2
35
- - JRuby
36
- - Rubinius
37
+ - [digest-sha3](https://github.com/phusion/digest-sha3-ruby)
38
+ - [sha3](https://github.com/johanns/sha3#readme)
37
39
 
38
40
  ## License
39
41
 
@@ -41,7 +41,7 @@ module Digest
41
41
  width = 200 - @size * 2
42
42
 
43
43
  buffer = @buffer
44
- buffer << "\x01" << "\0" * (width - buffer.size % width)
44
+ buffer << "\x06" << "\0" * (width - buffer.size % width)
45
45
  buffer[-1] = (buffer[-1].ord | 0x80).chr
46
46
 
47
47
  0.step buffer.size - 1, width do |j|
@@ -1,3 +1,3 @@
1
1
  class SHA3
2
- VERSION = '0.1.1'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -2,53 +2,58 @@ require File.expand_path '../../lib/sha3-pure-ruby', __FILE__
2
2
  require 'minitest/autorun'
3
3
  require 'minitest/pride'
4
4
 
5
+ # http://emn178.github.io/online-tools/sha3_224.html
6
+ # http://emn178.github.io/online-tools/sha3_256.html
7
+ # http://emn178.github.io/online-tools/sha3_512.html
8
+ # http://emn178.github.io/online-tools/sha3_384.html
9
+
5
10
  describe Digest::SHA3 do
6
11
  describe 'default 512-bit' do
7
12
  it 'should work when empty' do
8
- empty_string_sha3 = '0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e'
13
+ empty_string_sha3 = 'a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26'
9
14
  assert_equal Digest::SHA3.new.hexdigest(''), empty_string_sha3
10
15
  end
11
16
 
12
17
  it 'should work with content' do
13
- cat_sha3 = "b2faf80c85bd36029dc3f804cbf439888fd1ca195ab0e3decb872f8aa9ef767e4866186ebb8b5ecfa1237147a94775f8302648be0fd0ae3a6ebbdf931f423360"
18
+ cat_sha3 = "fe37dd66fa849ca98684160d542538b22c1edb576271d76b319ded4965d90143a0806fe1edf29b82b8740ec177880769629bdd1a0fb7cb97d7640e60c44833d3"
14
19
  assert_equal Digest::SHA3.new.hexdigest('cat'), cat_sha3
15
20
  end
16
21
  end
17
22
 
18
23
  describe '384-bit' do
19
24
  it 'should work when empty' do
20
- empty_string_sha3 = '2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff'
25
+ empty_string_sha3 = '0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004'
21
26
  assert_equal Digest::SHA3.new(384).hexdigest(''), empty_string_sha3
22
27
  end
23
28
 
24
29
  it 'should work with content' do
25
- cat_sha3 = 'fbcae9b945da6967b622e93e5712dcd0b4df2f522a89b0a20b485684c02efcf9efafb699499b2328172cbf654b7721c5'
30
+ cat_sha3 = '9bb4adf3004b3ed61f76195321621eac835b6502db486a53b64fdb69c50ee1a8dbb05c950577db70be2bafed59f8891d'
26
31
  assert_equal Digest::SHA3.new(384).hexdigest('cat'), cat_sha3
27
32
  end
28
33
  end
29
34
 
30
35
  describe '256-bit' do
31
36
  it 'should work when empty' do
32
- empty_string_sha3 = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
37
+ empty_string_sha3 = 'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a'
33
38
  assert_equal Digest::SHA3.new(256).hexdigest(''), empty_string_sha3
34
39
  end
35
40
 
36
41
  it 'should work with content' do
37
- cat_sha3 = '52763589e772702fa7977a28b3cfb6ca534f0208a2b2d55f7558af664eac478a'
42
+ cat_sha3 = 'd616607d3e4ba96a74f323cffc5f20a3c78e7cab8ecbdbb03b13fa8ffc9bf644'
38
43
  assert_equal Digest::SHA3.new(256).hexdigest('cat'), cat_sha3
39
44
  end
40
45
  end
41
46
 
42
47
  describe '224-bit' do
43
48
  it 'should work when empty' do
44
- empty_string_sha3 = 'f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd'
49
+ empty_string_sha3 = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7'
45
50
  assert_equal Digest::SHA3.new(224).hexdigest(''), empty_string_sha3
46
51
  end
47
52
 
48
53
  it 'should work with content' do
49
- cat_sha3 = "c3e4d225cefd1d01166d801f856907492b3bf8909a8a3a5bc922580f"
54
+ cat_sha3 = "447c857980c93d613b8bd6897c05bfd0621245139f021aaa6b57830a"
50
55
  assert_equal Digest::SHA3.new(224).hexdigest('cat'), cat_sha3
51
56
  end
52
57
  end
53
58
  end
54
-
59
+
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sha3-pure-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - havenwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-21 00:00:00.000000000 Z
11
+ date: 2016-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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
40
  version: '0'
41
41
  description: An implementation of SHA3 in pure Ruby.
@@ -45,10 +45,10 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
49
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - ChangeLog.md
50
51
  - Gemfile
51
- - Gemfile.lock
52
52
  - README.md
53
53
  - Rakefile
54
54
  - lib/sha3-pure-ruby.rb
@@ -65,17 +65,17 @@ require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.0.3
78
+ rubygems_version: 2.6.3
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Pure Ruby SHA3.
@@ -1,14 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- sha3-pure-ruby (0.0.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
-
10
- PLATFORMS
11
- ruby
12
-
13
- DEPENDENCIES
14
- sha3-pure-ruby!