blake.rb 0.0.1 → 0.0.2
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/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +8 -8
- data/.travis.yml +1 -1
- data/README.md +1 -1
- data/blake.gemspec +2 -2
- data/lib/blake/main.rb +9 -4
- data/lib/blake/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f627ac4914f88caa2e9a15b7f80daba13644e6119d78c19784b27479ad6c40ca
|
4
|
+
data.tar.gz: 32f672f0793255f548e42538b2dfc18258b2cfe2fa8e822acf1e2eda3a719c0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca110a228980cc54ce9fc8a33c68fe200bd15e2ec30b11b9208b6f4c0d46f9ae14ff48ca0c89699a83713e6449095029d3dcd72b8016f2ac6522328d33303040
|
7
|
+
data.tar.gz: 786ddd715778bef1234e9bc51faf1bf139795e5e88560323f46b59aae342e50ec2dd02e3754e5f7b1a5a8ccad927ad0e019864b43672d9052e4740deeae08dee
|
data/.rubocop.yml
CHANGED
@@ -29,6 +29,15 @@ Style/FrozenStringLiteralComment:
|
|
29
29
|
Enabled: true
|
30
30
|
EnforcedStyle: always
|
31
31
|
|
32
|
+
Style/HashEachMethods:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
Style/HashTransformKeys:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Style/HashTransformValues:
|
39
|
+
Enabled: true
|
40
|
+
|
32
41
|
Style/IfUnlessModifier:
|
33
42
|
Enabled: false
|
34
43
|
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-02-22
|
3
|
+
# on 2020-02-22 18:21:26 +0300 using RuboCop version 0.80.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -14,12 +14,12 @@ Metrics/AbcSize:
|
|
14
14
|
# Configuration parameters: CountComments, ExcludedMethods.
|
15
15
|
# ExcludedMethods: refine
|
16
16
|
Metrics/BlockLength:
|
17
|
-
Max:
|
17
|
+
Max: 121
|
18
18
|
|
19
19
|
# Offense count: 1
|
20
20
|
# Configuration parameters: CountComments.
|
21
21
|
Metrics/ClassLength:
|
22
|
-
Max:
|
22
|
+
Max: 178
|
23
23
|
|
24
24
|
# Offense count: 1
|
25
25
|
Metrics/CyclomaticComplexity:
|
@@ -28,7 +28,7 @@ Metrics/CyclomaticComplexity:
|
|
28
28
|
# Offense count: 3
|
29
29
|
# Configuration parameters: CountComments, ExcludedMethods.
|
30
30
|
Metrics/MethodLength:
|
31
|
-
Max:
|
31
|
+
Max: 32
|
32
32
|
|
33
33
|
# Offense count: 1
|
34
34
|
Metrics/PerceivedComplexity:
|
@@ -37,15 +37,15 @@ Metrics/PerceivedComplexity:
|
|
37
37
|
# Offense count: 2
|
38
38
|
# Cop supports --auto-correct.
|
39
39
|
# Configuration parameters: EnforcedStyle.
|
40
|
-
# SupportedStyles: always, never
|
40
|
+
# SupportedStyles: always, always_true, never
|
41
41
|
Style/FrozenStringLiteralComment:
|
42
42
|
Exclude:
|
43
43
|
- 'lib/blake/main.rb'
|
44
|
-
- 'spec/lib/
|
44
|
+
- 'spec/lib/blake_spec.rb'
|
45
45
|
|
46
|
-
# Offense count:
|
46
|
+
# Offense count: 24
|
47
47
|
# Cop supports --auto-correct.
|
48
48
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
49
49
|
# URISchemes: http, https
|
50
|
-
|
50
|
+
Layout/LineLength:
|
51
51
|
Max: 141
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/blake.gemspec
CHANGED
@@ -37,11 +37,11 @@ Gem::Specification.new do |spec|
|
|
37
37
|
f.match %r{^(test|spec)/}
|
38
38
|
end
|
39
39
|
|
40
|
-
spec.add_development_dependency 'bundler', '~> 1
|
40
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
41
41
|
spec.add_development_dependency 'pry', '~> 0.12'
|
42
42
|
spec.add_development_dependency 'rake', '~> 12.3'
|
43
43
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
44
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
44
|
+
spec.add_development_dependency 'rubocop', '~> 0.80'
|
45
45
|
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
|
46
46
|
spec.add_development_dependency 'simplecov', '~> 0.17'
|
47
47
|
end
|
data/lib/blake/main.rb
CHANGED
@@ -136,17 +136,22 @@ module Blake
|
|
136
136
|
self.salt = salt if salt != @salt
|
137
137
|
|
138
138
|
# pad input and append its length in bits
|
139
|
+
input.force_encoding('binary')
|
139
140
|
total_bits = input.length * 8
|
140
|
-
input << "\x80" # mark the end of the input
|
141
|
+
input << "\x80".force_encoding('binary') # mark the end of the input
|
141
142
|
rem = (input.length + @word_size * 2) % block_size
|
142
143
|
# pad to block size - (2 * word size)
|
143
|
-
|
144
|
+
if rem.positive?
|
145
|
+
input << ("\0" * (block_size - rem)).force_encoding('binary')
|
146
|
+
end
|
144
147
|
# set last marker bit
|
145
148
|
input[-1] = (input[-1].ord | 0x01).chr if (output_words % 32).zero?
|
146
149
|
# append high-order bytes of input bit length
|
147
|
-
|
150
|
+
if @word_size == 8
|
151
|
+
input << [total_bits >> 64].pack('Q>').force_encoding('binary')
|
152
|
+
end
|
148
153
|
# append low-order bytes of input bit length
|
149
|
-
input << [total_bits & MASK64BITS].pack('Q>')
|
154
|
+
input << [total_bits & MASK64BITS].pack('Q>').force_encoding('binary')
|
150
155
|
|
151
156
|
@state = case output_words
|
152
157
|
when 28 then IV28.dup
|
data/lib/blake/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blake.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Cavanagh (danielcavanagh)
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.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: '1
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.80'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.80'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-performance
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|