symmetric-encryption 3.0.2 → 3.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: e317defa3d42505af60cafe4a0b2536eece87610
4
- data.tar.gz: 457e73b4600877ccb94491bac705fe2d5cb07b8b
3
+ metadata.gz: e9372dc10ff0f61fac4ce5b15b1166c12e0623e1
4
+ data.tar.gz: b5953a44d66dff085cd6417622bad5e0ca7cdeb5
5
5
  SHA512:
6
- metadata.gz: 628ef9f9873e93d96d276775033524d2f40744e289760be21f7e9c3c2bdaf99f8b65af5313e7c3d8c2e6a861ef4d49918695733ff62420728d1fe0628407f9b3
7
- data.tar.gz: a94058c40a5f285a7dc78207cceb980546cdd09dfcfe90fc11a28c727029868d50b63183c7cceee03d1d9f741b939ab73293484b5984fb3a71edc841bb40f0d9
6
+ metadata.gz: 1bb09ce303a73a7031f4c8b6f8561ed3fd60239cdd75d7ad8251bdcb4708273d21207f2ae007fb1898ecc00e6b8fefbf6a7b318577105eee009da2825e2aee43
7
+ data.tar.gz: 1e579b442711e49ac774efcd53cf453a862e6917e1469053fe52fc310cf114059ee5c121a60d0e3243016fcb8b2234fffa4f63e987c4e4cc7646fc8dbf88e230
@@ -81,7 +81,7 @@ module SymmetricEncryption
81
81
  # successfully returns a string of data
82
82
  def self.decrypt(encrypted_and_encoded_string, version=nil)
83
83
  raise "Call SymmetricEncryption.load! or SymmetricEncryption.cipher= prior to encrypting or decrypting data" unless @@cipher
84
- return if encrypted_and_encoded_string.nil? || (encrypted_and_encoded_string == '')
84
+ return encrypted_and_encoded_string if encrypted_and_encoded_string.nil? || (encrypted_and_encoded_string == '')
85
85
 
86
86
  str = encrypted_and_encoded_string.to_s
87
87
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module SymmetricEncryption #:nodoc
3
- VERSION = "3.0.2"
3
+ VERSION = "3.0.3"
4
4
  end
@@ -77,6 +77,22 @@ class CipherTest < Test::Unit::TestCase
77
77
  assert_equal @social_security_number_encrypted, @cipher.encrypt(@social_security_number)
78
78
  end
79
79
 
80
+ should "return nil when encrypting nil" do
81
+ assert_equal nil, @cipher.encrypt(nil)
82
+ end
83
+
84
+ should "return '' when encrypting ''" do
85
+ assert_equal '', @cipher.encrypt('')
86
+ end
87
+
88
+ should "return nil when decrypting nil" do
89
+ assert_equal nil, @cipher.decrypt(nil)
90
+ end
91
+
92
+ should "return '' when decrypting ''" do
93
+ assert_equal '', @cipher.decrypt('')
94
+ end
95
+
80
96
  should "decrypt string" do
81
97
  assert_equal @social_security_number, @cipher.decrypt(@social_security_number_encrypted)
82
98
  end
@@ -83,6 +83,22 @@ class SymmetricEncryptionTest < Test::Unit::TestCase
83
83
  assert_equal @social_security_number, SymmetricEncryption.decrypt(@social_security_number_encrypted)
84
84
  end
85
85
 
86
+ should "return nil when encrypting nil" do
87
+ assert_equal nil, SymmetricEncryption.encrypt(nil)
88
+ end
89
+
90
+ should "return '' when encrypting ''" do
91
+ assert_equal '', SymmetricEncryption.encrypt('')
92
+ end
93
+
94
+ should "return nil when decrypting nil" do
95
+ assert_equal nil, SymmetricEncryption.decrypt(nil)
96
+ end
97
+
98
+ should "return '' when decrypting ''" do
99
+ assert_equal '', SymmetricEncryption.decrypt('')
100
+ end
101
+
86
102
  should "determine if string is encrypted" do
87
103
  assert_equal true, SymmetricEncryption.encrypted?(@social_security_number_encrypted)
88
104
  assert_equal false, SymmetricEncryption.encrypted?(@social_security_number)
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symmetric-encryption
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison