radiantcms-couchrest_model 0.2.1 → 0.2.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{radiantcms-couchrest_model}
5
- s.version = "0.2.1"
5
+ s.version = "0.2.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["davide-malagoli"]
@@ -40,15 +40,22 @@ module ActiveSupport
40
40
  private
41
41
  # constant-time comparison algorithm to prevent timing attacks
42
42
  def secure_compare(a, b)
43
- if a.length == b.length
44
- result = 0
45
- for i in 0..(a.length - 1)
46
- result |= a[i] ^ b[i]
47
- end
48
- result == 0
49
- else
50
- false
51
- end
43
+ #if a.length == b.length
44
+ # result = 0
45
+ # for i in 0..(a.length - 1)
46
+ # result |= a[i] ^ b[i]
47
+ # end
48
+ # result == 0
49
+ #else
50
+ # false
51
+ #end
52
+ return false unless a.bytesize == b.bytesize
53
+
54
+ l = a.unpack "C#{a.bytesize}"
55
+
56
+ res = 0
57
+ b.each_byte { |byte| res |= byte ^ l.shift }
58
+ res == 0
52
59
  end
53
60
 
54
61
  def generate_digest(data)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - davide-malagoli