yaml_zlib_blowfish 1.0.0 → 2.0.230116
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{README.rdoc → README.md} +19 -18
- data/lib/yaml_zlib_blowfish.rb +7 -5
- metadata +8 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b1db25885593ca06a9464c917ea8646d7e1adca8a5de2a578ef78bedfb8cfd60
|
4
|
+
data.tar.gz: d10c7751ef1e43e504f782d3c0712871a741704f12f48bbf9ffcfd23c148a2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a7c740b8cfc8944725d3a2ae541f2d89c71a75072b9b6eaac822acf814801bea6da2547f9d5818fc269ee3d54f29d54bcf415e44b02d787a78d522b5fc6385
|
7
|
+
data.tar.gz: c059dfa7c9fda033f2d6e29ad301736e6c4081977210baef4a244ac03bb3f5d513bbd3c6e9c292af661c00ae481838264985a8d5cc524ca2261bdd7d4088284a
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,32 +1,33 @@
|
|
1
|
-
|
1
|
+
# YamlZlibBlowfish
|
2
2
|
|
3
|
-
|
3
|
+
* [VERSION 2.0.230116](https://github.com/carlosjhr64/yaml_zlib_blowfish/releases)
|
4
|
+
* [github](https://github.com/carlosjhr64/yaml_zlib_blowfish)
|
5
|
+
* [rubygems](https://rubygems.org/gems/yaml_zlib_blowfish)
|
4
6
|
|
5
|
-
|
7
|
+
## DESCRIPTION:
|
6
8
|
|
7
9
|
Have you ever wanted to YAML dump, Zlib compress, and Blowfish encrypt your data structures?
|
8
10
|
YOU HAVE!? Well...
|
9
11
|
|
10
|
-
|
12
|
+
## SYNOPSIS:
|
13
|
+
```ruby
|
14
|
+
require 'yaml_zlib_blowfish'
|
15
|
+
conf0 = [ 1, 2.0, 'Three', :four, {five: 'Cinco'}]
|
16
|
+
yzb = YamlZlibBlowfish.new('Secret PaSspHrase!')
|
17
|
+
yzb.dump('./tmp/dump.yzb', conf0)
|
18
|
+
conf1 = yzb.load('./tmp/dump.yzb')
|
19
|
+
conf1 == conf0 #=> true
|
20
|
+
# ...
|
21
|
+
```
|
22
|
+
## INSTALL:
|
11
23
|
|
12
|
-
|
13
|
-
# ...
|
14
|
-
yzb = YamlZlibBlowfish.new('passphrase')
|
15
|
-
data = yzb.load('./path_to/file.yzb')
|
16
|
-
# ...
|
17
|
-
yzb.dump('./path_to/file.yzb', data)
|
24
|
+
$ gem install yaml_zlib_blowfish
|
18
25
|
|
19
|
-
|
20
|
-
|
21
|
-
== INSTALL:
|
22
|
-
|
23
|
-
$ sudo gem install yaml_zlib_blowfish
|
24
|
-
|
25
|
-
== LICENSE:
|
26
|
+
## LICENSE:
|
26
27
|
|
27
28
|
(The MIT License)
|
28
29
|
|
29
|
-
Copyright (c)
|
30
|
+
Copyright (c) 2023 CarlosJHR64
|
30
31
|
|
31
32
|
Permission is hereby granted, free of charge, to any person obtaining
|
32
33
|
a copy of this software and associated documentation files (the
|
data/lib/yaml_zlib_blowfish.rb
CHANGED
@@ -5,20 +5,22 @@ require 'openssl'
|
|
5
5
|
require 'digest/sha2'
|
6
6
|
|
7
7
|
class YamlZlibBlowfish
|
8
|
-
VERSION = '
|
8
|
+
VERSION = '2.0.230116'
|
9
9
|
|
10
10
|
# yzb = YamlZlibBlowfish.new(passphrase)
|
11
11
|
def initialize(passphrase)
|
12
|
-
key
|
12
|
+
# Blowfish takes a variable length key from 32 to 448 bits.
|
13
|
+
# Here we create a 256 bit key based on the pass-phrase:
|
14
|
+
@key = Digest::SHA256.digest(passphrase)
|
13
15
|
@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
|
21
|
+
cipher = @cipher.send(mode)
|
22
|
+
cipher.key_len = @key.length
|
23
|
+
cipher.key = @key
|
22
24
|
cipher.update(data) << cipher.final
|
23
25
|
end
|
24
26
|
|
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: 2.0.230116
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- CarlosJHR64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-16 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?
|
@@ -16,19 +16,16 @@ description: |
|
|
16
16
|
email: carlosjhr64@gmail.com
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
|
-
extra_rdoc_files:
|
20
|
-
- README.rdoc
|
19
|
+
extra_rdoc_files: []
|
21
20
|
files:
|
22
|
-
- README.
|
21
|
+
- README.md
|
23
22
|
- lib/yaml_zlib_blowfish.rb
|
24
23
|
homepage: https://github.com/carlosjhr64/yaml_zlib_blowfish
|
25
24
|
licenses:
|
26
25
|
- MIT
|
27
26
|
metadata: {}
|
28
27
|
post_install_message:
|
29
|
-
rdoc_options:
|
30
|
-
- "--main"
|
31
|
-
- README.rdoc
|
28
|
+
rdoc_options: []
|
32
29
|
require_paths:
|
33
30
|
- lib
|
34
31
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -42,9 +39,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
39
|
- !ruby/object:Gem::Version
|
43
40
|
version: '0'
|
44
41
|
requirements:
|
45
|
-
- 'ruby: ruby 2.
|
46
|
-
|
47
|
-
rubygems_version: 2.6.11
|
42
|
+
- 'ruby: ruby 3.2.0 (2022-12-25 revision a528908271) [aarch64-linux]'
|
43
|
+
rubygems_version: 3.4.3
|
48
44
|
signing_key:
|
49
45
|
specification_version: 4
|
50
46
|
summary: Have you ever wanted to YAML dump, Zlib compress, and Blowfish encrypt your
|