fast_secure_compare 0.0.2 → 0.0.3

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: 1b49fc77195a730ff81966f32d327f2e4eafda4b
4
- data.tar.gz: cc68be175b411a1d1f6867d8e9a7f0443269be40
3
+ metadata.gz: e3fb2369f25ee854588c61eee84e3e8d83101935
4
+ data.tar.gz: 9ce4e51ea075a0356c94a5fbfa2ba73d782a747f
5
5
  SHA512:
6
- metadata.gz: d1bd92fc4dcc15967c9e2dc614bf492c6722c10e898fc3e5a8cf2121739ec8da1dd12b7093e5daddcfaed20f08c2083ec4a984b8ba7620ae25b16186d193ad92
7
- data.tar.gz: f473788cc8c4c789f02d9262593290f5e8e0eb4a12024d73f0099592ce622642215d367bb0ae17b4679e74bb48ac9da5c08e7377bd4245dfe8b4950a34f2592e
6
+ metadata.gz: 014835e0a31b4c6c22e776c6641f77a82a41edef1be4048e20f9aeb201e5b2707d16ea52748ebd3affcd4152f66b7268325f295a8cc85567a5398902ecf53979
7
+ data.tar.gz: ee5a4427431ecb102938ef55bc6cf8588bae22e71f9e90fe32c5f73f17c5db0bd0334d4165c952ef1f0cef4c21302ab10d17f16edcee84297ac099027baf16c8
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'fast_secure_compare'
3
- s.version = '0.0.2'
4
- s.date = '2014-08-17'
3
+ s.version = '0.0.3'
4
+ s.date = '2014-08-18'
5
5
  s.summary = "A fast, simple way to do constant time string comparisons."
6
6
  s.description = "A secure_comparison function implemented in C for blazing speed."
7
7
  s.authors = ["Daniel Axtens"]
@@ -8,6 +8,7 @@ module FastSecureCompare
8
8
  attach_function :secure_compare_bytes, [:pointer, :uint, :pointer, :uint], :int
9
9
 
10
10
  def self.compare(secret, input)
11
+ return false if secret == "" and input != ""
11
12
  sBuf = FFI::MemoryPointer.new(:char, secret.size)
12
13
  sBuf.put_bytes(0, secret)
13
14
  iBuf = FFI::MemoryPointer.new(:char, input.size)
@@ -14,4 +14,11 @@ describe FastSecureCompare, "#compare" do
14
14
  it "returns false on different strings of equal length" do
15
15
  expect(FastSecureCompare.compare("aaa","bbb")).to eq(false)
16
16
  end
17
+ it "returns true on two empty strings." do
18
+ expect(FastSecureCompare.compare("","")).to eq(true)
19
+ end
20
+ it "returns false on one empty string, one non-empty string." do
21
+ expect(FastSecureCompare.compare("a","")).to eq(false)
22
+ expect(FastSecureCompare.compare("","a")).to eq(false)
23
+ end
17
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_secure_compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Axtens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-17 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-compiler