go_secure 0.67 → 0.70
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/go_secure.rb +4 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c1ac3e5ca4f3cec1163eaaf94c96aeecbf9d7598a0b36b0a88b62c02ce0fdf6
|
4
|
+
data.tar.gz: 8ed2bd8c670d7903aac0c7ae127f121d1e03d39d46aeb104d6d005141b6892d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '06197b6cc0e35b7ba5fe6547ad58b27fff19726fe6a2508af31595c059f8f0ce23c589111c77f8a22c4de50d952a7610ea9fdc6aa187ef4b481d2df2885d15e7'
|
7
|
+
data.tar.gz: 493403cce547664bf0f29bf581ca0ee68af32ddb8d70637d37fe33fa65ea95eed5a1071cba08b8a2642b6d53120da48424d38d7f7bc74d82176ec5f4abc76898
|
data/lib/go_secure.rb
CHANGED
@@ -23,13 +23,15 @@ module GoSecure
|
|
23
23
|
Digest::SHA512.hexdigest(str.to_s + Time.now.to_i.to_s + rand(999999).to_s + self.encryption_key)[0, 24]
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.encrypt(str, ref, encryption_key=nil)
|
26
|
+
def self.encrypt(str, ref, encryption_key=nil, iv=nil)
|
27
27
|
require 'base64'
|
28
28
|
c = OpenSSL::Cipher.new('aes-256-cbc')
|
29
29
|
c.encrypt
|
30
30
|
sha = Digest::SHA2.hexdigest(ref + "_" + (encryption_key || self.encryption_key))
|
31
31
|
c.key = sha[0..31]
|
32
|
-
|
32
|
+
raise "invalid iv" if iv && iv.length != 16
|
33
|
+
iv = iv || c.random_iv
|
34
|
+
c.iv = iv
|
33
35
|
e = c.update(str)
|
34
36
|
e << c.final
|
35
37
|
res = [Base64.encode64(e), Base64.encode64(iv)]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_secure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.70'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Whitmer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -66,7 +66,7 @@ homepage: https://github.com/CoughDrop/obf
|
|
66
66
|
licenses:
|
67
67
|
- MIT
|
68
68
|
metadata: {}
|
69
|
-
post_install_message:
|
69
|
+
post_install_message:
|
70
70
|
rdoc_options: []
|
71
71
|
require_paths:
|
72
72
|
- lib
|
@@ -81,9 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
rubyforge_project:
|
84
|
+
rubyforge_project:
|
85
85
|
rubygems_version: 2.7.6
|
86
|
-
signing_key:
|
86
|
+
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Go Secure
|
89
89
|
test_files: []
|