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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8140c9848f3b27b2853fade488e4d6e13f8670d0
4
- data.tar.gz: a8bda76cf67c032024b68fcad8f3ffb43eeff8d0
3
+ metadata.gz: b8ffc4b4f4f359a216517028ba9246b6b48f3d8e
4
+ data.tar.gz: 3f4582fd29c022fe7746446da0b6fb6c4204ceeb
5
5
  SHA512:
6
- metadata.gz: e60b8ab466fac3b10dc52b09e07cd7ba895eb0215da6307545151c9663332566045cebd1c70a4028c4a399e6fdb1c1887887009c5d98f9a32fc2a806d40840c5
7
- data.tar.gz: dc4dbbc62745c59b7b8464d0ea7d9a9925e0b8380d65f2b17aed3072bbc99f65d1449854112116087145f1aacb0c21351a1dcbe4aa268c0f37ac69c373f64c01
6
+ metadata.gz: 78f5e0641c0efd5e280cc298050c72742df839c0d20366e9eaf8f252ef1399166bcb5edab7ffbf87341e1016eaabb551d9f4caeaf882a708c65402f4ec95102e
7
+ data.tar.gz: b7ce3d6d79f075dc854f8c6344c834ae36c55deebc81e6bf0aa07f4ab8999c94818a93455502645803a00b9efef7e6dc1a1f31aa2c1b237dd1178f3c97dcbf9b
data/README.rdoc CHANGED
@@ -16,6 +16,8 @@ YOU HAVE!? Well...
16
16
  # ...
17
17
  yzb.dump('./path_to/file.yzb', data)
18
18
 
19
+ Warning: this version(~1) is incompatible to prior alpha versions(~0).
20
+
19
21
  == INSTALL:
20
22
 
21
23
  $ sudo gem install yaml_zlib_blowfish
@@ -5,22 +5,20 @@ require 'openssl'
5
5
  require 'digest/sha2'
6
6
 
7
7
  class YamlZlibBlowfish
8
- VERSION = '0.1.0'
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
- @key = Digest::SHA256.digest(passphrase)[0..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
- #cipher = OpenSSL::Cipher.new('bf-cbc').send(mode)
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: 0.1.0
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-28 00:00:00.000000000 Z
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?