xkcd936 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3ab3ee6f0bee59bc50b0910a7013dc281f90de25
4
+ data.tar.gz: 82a6ffd0105226d0b0dabdf097dc78f519ed2817
5
+ SHA512:
6
+ metadata.gz: 6d913f6d591b18a21270f0e8b3b0ad956dc9606ff498ae61859665324db40b92f3c887f261602893d504ff8f3f65d889d64b3d36b4ff154cbceba97f303a1455
7
+ data.tar.gz: 8fc6ea179996e8298efd555548e4ae8f69eb8a7ac73c30bc5f4e645b4ae9dc9f23f06e944bc37a4ff96906c456efa8e278373297e72bc46fb3d212a659a6c037
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.idea/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xkcd936.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jakukyo Friel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Xkcd936
2
+
3
+ [xkcd936](https://www.xkcd.com/936/) style passphrase generator.
4
+
5
+ But we use 5 words instead of 4, since 5 words will achieve an entropy of:
6
+
7
+ $$log(99171)/log(2)*5 = 82.988$$
8
+
9
+ This is enough.
10
+ NIST recommends 80-bits for the most secure passwords.
11
+ And it roughly needs 6 billions USD to break.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'xkcd936'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install xkcd936
28
+
29
+ ## Usage
30
+
31
+ As a library:
32
+
33
+ ```ruby
34
+ require 'xkcd936'
35
+ Xkcd936.generate_passphrase('path/to/dictionary/file')
36
+ ```
37
+
38
+ If you does not give a path, it will use `/usr/share/dict/words` as default.
39
+
40
+ As a command line tool:
41
+
42
+ ```ruby
43
+ ; xkcd936
44
+ ```
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it ( https://github.com/weakish/xkcd936/fork )
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/xkcd936 ADDED
@@ -0,0 +1,3 @@
1
+ require 'xkcd936'
2
+
3
+ puts Xkcd936.generate_passphrase
@@ -0,0 +1,3 @@
1
+ module Xkcd936
2
+ VERSION = "0.0.1"
3
+ end
data/lib/xkcd936.rb ADDED
@@ -0,0 +1,18 @@
1
+ require "xkcd936/version"
2
+
3
+ module Xkcd936
4
+ module_function
5
+
6
+ # Inspired by http://xkcd.com/936/
7
+ # But I use 5 words instead of 4, since 5 words will achieve an entropy of:
8
+ # log(99171)/log(2)*5 = 82.988
9
+ # This is enough.
10
+ # NIST recommends 80-bits for the most secure passwords.
11
+ # And it roughly needs 6 billions USD to break.
12
+ #
13
+ # @param [String] dict file path
14
+ # @return [String] passphrase
15
+ def generate_passphrase(dict='/usr/share/dict/words')
16
+ (IO.readlines(dict).sample(5).map { |s| s.chomp.capitalize }).join
17
+ end
18
+ end
data/xkcd936.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xkcd936/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xkcd936"
8
+ spec.version = Xkcd936::VERSION
9
+ spec.authors = ["Jakukyo Friel"]
10
+ spec.email = ["weakish@gmail.com"]
11
+ spec.summary = %q{xkcd936 style passphrase generator.}
12
+ spec.homepage = "https://github.com/weakish/xkcd936"
13
+ spec.license = "MIT"
14
+ spec.metadata = {
15
+ 'repository' => 'https://github.com/weakish/xkcd936.git',
16
+ 'documentation' => 'http://www.rubydoc.info/gems/xkcd936',
17
+ 'issues' => 'https://github.com/weakish/xkcd936/issues',
18
+ 'wiki' => 'https://github.com/weakish/xkcd936/wiki'
19
+ }
20
+
21
+ spec.files = `git ls-files -z`.split("\x0")
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.7"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xkcd936
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jakukyo Friel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - weakish@gmail.com
44
+ executables:
45
+ - xkcd936
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/xkcd936
55
+ - lib/xkcd936.rb
56
+ - lib/xkcd936/version.rb
57
+ - xkcd936.gemspec
58
+ homepage: https://github.com/weakish/xkcd936
59
+ licenses:
60
+ - MIT
61
+ metadata:
62
+ repository: https://github.com/weakish/xkcd936.git
63
+ documentation: http://www.rubydoc.info/gems/xkcd936
64
+ issues: https://github.com/weakish/xkcd936/issues
65
+ wiki: https://github.com/weakish/xkcd936/wiki
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.2
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: xkcd936 style passphrase generator.
86
+ test_files: []
87
+ has_rdoc: