yaml_zlib_blowfish 0.1.0 → 1.0.0
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.
- checksums.yaml +4 -4
- data/README.rdoc +2 -0
- data/lib/yaml_zlib_blowfish.rb +6 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8ffc4b4f4f359a216517028ba9246b6b48f3d8e
|
4
|
+
data.tar.gz: 3f4582fd29c022fe7746446da0b6fb6c4204ceeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f5e0641c0efd5e280cc298050c72742df839c0d20366e9eaf8f252ef1399166bcb5edab7ffbf87341e1016eaabb551d9f4caeaf882a708c65402f4ec95102e
|
7
|
+
data.tar.gz: b7ce3d6d79f075dc854f8c6344c834ae36c55deebc81e6bf0aa07f4ab8999c94818a93455502645803a00b9efef7e6dc1a1f31aa2c1b237dd1178f3c97dcbf9b
|
data/README.rdoc
CHANGED
data/lib/yaml_zlib_blowfish.rb
CHANGED
@@ -5,22 +5,20 @@ require 'openssl'
|
|
5
5
|
require 'digest/sha2'
|
6
6
|
|
7
7
|
class YamlZlibBlowfish
|
8
|
-
VERSION = '
|
9
|
-
|
10
|
-
# cypher_key = yzb.key
|
11
|
-
attr_accessor :key
|
8
|
+
VERSION = '1.0.0'
|
12
9
|
|
13
10
|
# yzb = YamlZlibBlowfish.new(passphrase)
|
14
11
|
def initialize(passphrase)
|
15
|
-
|
12
|
+
key = Digest::SHA256.digest(passphrase)
|
13
|
+
@cipher = OpenSSL::Cipher::BF.new(:CBC)
|
14
|
+
@cipher.key_len = key.length
|
15
|
+
@cipher.key = key
|
16
16
|
end
|
17
17
|
|
18
18
|
# encrypted_string = yzb.cipher(:encrypt, plain_string)
|
19
19
|
# plain_string = yzb.cipher(:decrypt, encrypted_string)
|
20
20
|
def cipher(mode, data)
|
21
|
-
|
22
|
-
cipher = OpenSSL::Cipher::BF.new(:CBC).send(mode)
|
23
|
-
cipher.key = @key
|
21
|
+
cipher = @cipher.send(mode)
|
24
22
|
cipher.update(data) << cipher.final
|
25
23
|
end
|
26
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_zlib_blowfish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Have you ever wanted to YAML dump, Zlib compress, and Blowfish encrypt your data structures?
|