struggle 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/struggle/cipher.rb +20 -0
- data/lib/struggle.rb +1 -0
- metadata +3 -3
- data/lib/struggle/aes.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12d0930a5737bcca81309c72af840ca4ec4a6d37
|
4
|
+
data.tar.gz: 84919a03b2dd7b672a8b206e836d16b3740e700e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b12d2b517cc75f873a5fff5ac85512fd31c21fa15ab10203b76323657f1e5d9f7a5b6e13621981d73274bfb484082b5957f243d99e1710eaa5229558742b8a
|
7
|
+
data.tar.gz: fd491d62fbb6f3178eecea7d7d33ba9a7f7e6247b2f1d7b10ed673c6f1537e834247b46d394dab1da2207b40c82e483c9e41ccb0dd0a2efa7c971891482a766c
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Struggle
|
2
|
+
class Cipher
|
3
|
+
require 'openssl'
|
4
|
+
def self.encrypt(data, key ,iv)
|
5
|
+
cipher = OpenSSL::Cipher::AES.new(256, :CBC)
|
6
|
+
cipher.encrypt
|
7
|
+
cipher.key = key
|
8
|
+
cipher.iv = iv
|
9
|
+
cipher.update(data) + cipher.final
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.decipher(data, key ,iv)
|
13
|
+
decipher = OpenSSL::Cipher::AES.new(256, :CBC)
|
14
|
+
decipher.decrypt
|
15
|
+
decipher.key = key
|
16
|
+
decipher.iv = iv
|
17
|
+
decipher.update(data) + decipher.final
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/struggle.rb
CHANGED
@@ -13,6 +13,7 @@ require 'struggle/pay_gateway'
|
|
13
13
|
require 'struggle/sms'
|
14
14
|
require 'struggle/tmagick'
|
15
15
|
require 'struggle/vcode'
|
16
|
+
require 'struggle/cipher'
|
16
17
|
require 'struggle/concerns/string_extend'
|
17
18
|
require 'struggle/concerns/int_extend'
|
18
19
|
String.send :include, Struggle::StringExtend
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: struggle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lean
|
@@ -47,7 +47,7 @@ extra_rdoc_files:
|
|
47
47
|
files:
|
48
48
|
- README.md
|
49
49
|
- lib/struggle.rb
|
50
|
-
- lib/struggle/
|
50
|
+
- lib/struggle/cipher.rb
|
51
51
|
- lib/struggle/concerns/int_extend.rb
|
52
52
|
- lib/struggle/concerns/string_extend.rb
|
53
53
|
- lib/struggle/font/font.ttf
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.4.
|
82
|
+
rubygems_version: 2.4.6
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: struggle!
|
data/lib/struggle/aes.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
class Aes
|
2
|
-
require 'openssl'
|
3
|
-
def self.encrypt(data, key ,iv)
|
4
|
-
cipher = OpenSSL::Cipher::AES.new(256, :CBC)
|
5
|
-
cipher.encrypt
|
6
|
-
cipher.key = key
|
7
|
-
cipher.iv = iv
|
8
|
-
cipher.update(data) + cipher.final
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.decipher(data, key ,iv)
|
12
|
-
decipher = OpenSSL::Cipher::AES.new(256, :CBC)
|
13
|
-
decipher.decrypt
|
14
|
-
decipher.key = key
|
15
|
-
decipher.iv = iv
|
16
|
-
decipher.update(data) + decipher.final
|
17
|
-
end
|
18
|
-
end
|