sha3-pure-ruby 0.1.1 → 1.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +16 -5
- data/ChangeLog.md +3 -0
- data/README.md +12 -10
- data/lib/sha3-pure-ruby.rb +1 -1
- data/lib/sha3-pure-ruby/version.rb +1 -1
- data/test/test_sha3-pure-ruby.rb +14 -9
- metadata +12 -12
- data/Gemfile.lock +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6222f3acb7e1fd8de4bda2388e10a63a29a278ee
|
4
|
+
data.tar.gz: 9c5fa4404737f31566eef9b30926f75e291fb2d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555854cb001a2ba1683b60e858bd5a14a4d8a01b49364490bec92817cb738031b8a1bd4e8640b3483cb38d68707c0242c3c4e16aa1be3d725ccb1585477f6f4b
|
7
|
+
data.tar.gz: 99120487c7b33e36c595d382684eda30e41c289a88382e0c637a2688dc53332b3b1a9ea99dd1005df5e469e277d17b4710554830a201299a8b71fdbb2ac5e28d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -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.
|
4
|
-
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
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
|
data/ChangeLog.md
ADDED
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.
|
24
|
-
#=> "
|
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
|
-
#=> "
|
29
|
+
#=> "89354196ffd570c33c70a37da19b55a9761a3ae178488ee1345b7fae"
|
30
|
+
|
31
|
+
Digest::SHA3.hexdigest 'another way', 224
|
32
|
+
#=> "2e250b541367f0f86bbc6f701fb2bcd8e85c159497805580eae989e1"
|
28
33
|
```
|
29
34
|
|
30
|
-
##
|
35
|
+
## C-Extension Alternatives
|
31
36
|
|
32
|
-
-
|
33
|
-
-
|
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
|
|
data/lib/sha3-pure-ruby.rb
CHANGED
@@ -41,7 +41,7 @@ module Digest
|
|
41
41
|
width = 200 - @size * 2
|
42
42
|
|
43
43
|
buffer = @buffer
|
44
|
-
buffer << "\
|
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|
|
data/test/test_sha3-pure-ruby.rb
CHANGED
@@ -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 = '
|
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 = "
|
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 = '
|
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 = '
|
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 = '
|
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 = '
|
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 = '
|
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 = "
|
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.
|
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:
|
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.
|
78
|
+
rubygems_version: 2.6.3
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Pure Ruby SHA3.
|