blake.rb 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 55e8f3406599d56f1096eeb1a1ccb4798b8182abd4bcb085c7eb887f90f0d59c
4
- data.tar.gz: 11972db8f764c21587b0595a97ef2bc2e3baafaeac5953c7209036d764c5cb77
3
+ metadata.gz: f627ac4914f88caa2e9a15b7f80daba13644e6119d78c19784b27479ad6c40ca
4
+ data.tar.gz: 32f672f0793255f548e42538b2dfc18258b2cfe2fa8e822acf1e2eda3a719c0d
5
5
  SHA512:
6
- metadata.gz: 2e704069b8f67616819ac882939699429630b04aa5f16bf1dca6532f7503f1e555568b4aed26bae46a219ea1948264027d4d19bc311ef4ac5471e10746a13ad9
7
- data.tar.gz: 3ad0bb667e2468725cfeed7945be3f4fa4abd9a004f69e67a6256f03eb97997d54b786b371ee3c97265b7694c5fa9f34e3b924e5ec885165449f50800163f2d9
6
+ metadata.gz: ca110a228980cc54ce9fc8a33c68fe200bd15e2ec30b11b9208b6f4c0d46f9ae14ff48ca0c89699a83713e6449095029d3dcd72b8016f2ac6522328d33303040
7
+ data.tar.gz: 786ddd715778bef1234e9bc51faf1bf139795e5e88560323f46b59aae342e50ec2dd02e3754e5f7b1a5a8ccad927ad0e019864b43672d9052e4740deeae08dee
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-02-22 16:27:26 +0300 using RuboCop version 0.73.0.
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: 122
17
+ Max: 121
18
18
 
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments.
21
21
  Metrics/ClassLength:
22
- Max: 177
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: 29
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/blake/main_spec.rb'
44
+ - 'spec/lib/blake_spec.rb'
45
45
 
46
- # Offense count: 26
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
- Metrics/LineLength:
50
+ Layout/LineLength:
51
51
  Max: 141
@@ -5,4 +5,4 @@ rvm:
5
5
  - 2.6
6
6
  - 2.7
7
7
 
8
- before_install: gem install bundler -v 1.13.6
8
+ before_install: gem install bundler
data/README.md CHANGED
@@ -14,7 +14,7 @@ and 384 bits, respectively.
14
14
  ## Install
15
15
 
16
16
  ```
17
- gem install blake
17
+ gem install blake.rb
18
18
  ```
19
19
 
20
20
  ## Usage
@@ -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.16'
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.73'
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
@@ -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
- input << ("\0" * (block_size - rem)) if rem.positive?
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
- input << [total_bits >> 64].pack('Q>') if @word_size == 8
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Blake
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
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.1
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.16'
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.16'
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.73'
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.73'
82
+ version: '0.80'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop-performance
85
85
  requirement: !ruby/object:Gem::Requirement