reversible_cryptography 0.1.0 → 0.2.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: b4a880a0b830354528b288c488944d6bd294eb28
4
- data.tar.gz: 3a605628d19a4883eeb677ecb845b72844157587
3
+ metadata.gz: 4b8ceb52bb8366e939475256f82cee4197bdd645
4
+ data.tar.gz: 4df03b3cb5c06b804344f195e4d958861483fc0f
5
5
  SHA512:
6
- metadata.gz: 066c4f2bebed3fabf0ad9b1a1fc8b426d3f6342def145e298bee543002be280b9a48192f73ad485cf7a008bbcba3f6946ac75386f1b9498e0d4840cb1b59ce55
7
- data.tar.gz: de6354f2f52bb1f012e5831c953435cf4401b06f8f036472947be8264f4ea6cb750ffba2cbf9528272e9f2925b2c64891071aff52c41effad850fc8edcea6c2d
6
+ metadata.gz: 3107759517c36c88174738ce9a2f7a8e21c2e07e9458e23dff282c7a99e08e4b67e72f8847f8920822b6333e6945cb49c1d9cdd83fccab2b474fad77e57a4cee
7
+ data.tar.gz: ea0ff97c2e8c1fe047176b6daf37326da7ec35638c84e4ad8615db0873645eb5306b45e29809c985d437f9583bbefe0ca3aeee83d8bb3091fc908068612a1d61
data/README.md CHANGED
@@ -27,6 +27,34 @@ ReversibleCryptography::Message.encrypt(encrypted_message, "password") == "targe
27
27
  # => true
28
28
  ```
29
29
 
30
+ ### CLI
31
+ Add `reversible_cryptography` command
32
+
33
+ ```shell
34
+ $ reversible_cryptography
35
+
36
+ Commands:
37
+ reversible_cryptography decrypt [TEXT] # Decrypt text
38
+ reversible_cryptography encrypt [TEXT] # Encrypt text
39
+ reversible_cryptography help [COMMAND] # Describe available commands or one specific command
40
+ ```
41
+
42
+ #### Encrypt sample
43
+
44
+ ```shell
45
+ $ reversible_cryptography encrypt message
46
+ Input password:
47
+ md5:78e731027d8fd50ed642340b7c9a63b3:salt:252-235-72-88-180-7-195-229:aes-256-cfb:VH2JxqUU9Q==
48
+ ```
49
+
50
+ #### Decrypt sample
51
+
52
+ ```shell
53
+ reversible_cryptography decrypt md5:78e731027d8fd50ed642340b7c9a63b3:salt:252-235-72-88-180-7-195-229:aes-256-cfb:VH2JxqUU9Q==
54
+ Input password:
55
+ message
56
+ ```
57
+
30
58
  ## Development
31
59
 
32
60
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require 'reversible_cryptography/cli'
4
+
5
+ ReversibleCryptography::CLI.start(ARGV)
@@ -0,0 +1,26 @@
1
+ require 'thor'
2
+ require 'reversible_cryptography'
3
+
4
+ module ReversibleCryptography
5
+ class CLI < Thor
6
+ desc "encrypt [TEXT]", "Encrypt text"
7
+ option :password, type: :string, aliases: [:p]
8
+ def encrypt(plain_text=nil)
9
+ plain_text ||= ask("Input text:")
10
+ password = options[:password]
11
+ password ||= ask("Input password:", echo: false).tap { puts }
12
+
13
+ puts ReversibleCryptography::Message.encrypt(plain_text, password)
14
+ end
15
+
16
+ desc "decrypt [TEXT]", "Decrypt text"
17
+ option :password, type: :string, aliases: [:p]
18
+ def decrypt(encrypted_text=nil)
19
+ encrypted_text ||= ask("Input text:")
20
+ password = options[:password]
21
+ password ||= ask("Input password:", echo: false).tap { puts }
22
+
23
+ puts ReversibleCryptography::Message.decrypt(encrypted_text, password)
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module ReversibleCryptography
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "thor"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.8"
22
24
  spec.add_development_dependency "rake", "~> 10.0"
23
25
  spec.add_development_dependency "rspec"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reversible_cryptography
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takumi MIURA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -55,7 +69,8 @@ dependencies:
55
69
  description: A Símplifìed reversible encryption solution
56
70
  email:
57
71
  - mitaku1104@gmail.com
58
- executables: []
72
+ executables:
73
+ - reversible_cryptography
59
74
  extensions: []
60
75
  extra_rdoc_files: []
61
76
  files:
@@ -67,7 +82,9 @@ files:
67
82
  - Rakefile
68
83
  - bin/console
69
84
  - bin/setup
85
+ - exe/reversible_cryptography
70
86
  - lib/reversible_cryptography.rb
87
+ - lib/reversible_cryptography/cli.rb
71
88
  - lib/reversible_cryptography/message.rb
72
89
  - lib/reversible_cryptography/version.rb
73
90
  - reversible_cryptography.gemspec