pwqgen.rb 0.0.1 → 0.0.2.pre

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.
Files changed (52) hide show
  1. data/.travis.yml +5 -0
  2. data/ChangeLog +5 -0
  3. data/Gemfile +1 -2
  4. data/README.md +35 -0
  5. data/Rakefile +9 -0
  6. data/bin/pwqgen.rb +4 -3
  7. data/doc/ChangeLog.html +89 -0
  8. data/doc/Gemfile.html +89 -0
  9. data/doc/Pwqgen.html +217 -0
  10. data/doc/Pwqgen/Generator.html +225 -0
  11. data/doc/created.rid +8 -0
  12. data/doc/images/add.png +0 -0
  13. data/doc/images/brick.png +0 -0
  14. data/doc/images/brick_link.png +0 -0
  15. data/doc/images/bug.png +0 -0
  16. data/doc/images/bullet_black.png +0 -0
  17. data/doc/images/bullet_toggle_minus.png +0 -0
  18. data/doc/images/bullet_toggle_plus.png +0 -0
  19. data/doc/images/date.png +0 -0
  20. data/doc/images/delete.png +0 -0
  21. data/doc/images/find.png +0 -0
  22. data/doc/images/loadingAnimation.gif +0 -0
  23. data/doc/images/macFFBgHack.png +0 -0
  24. data/doc/images/package.png +0 -0
  25. data/doc/images/page_green.png +0 -0
  26. data/doc/images/page_white_text.png +0 -0
  27. data/doc/images/page_white_width.png +0 -0
  28. data/doc/images/plugin.png +0 -0
  29. data/doc/images/ruby.png +0 -0
  30. data/doc/images/tag_blue.png +0 -0
  31. data/doc/images/tag_green.png +0 -0
  32. data/doc/images/transparent.png +0 -0
  33. data/doc/images/wrench.png +0 -0
  34. data/doc/images/wrench_orange.png +0 -0
  35. data/doc/images/zoom.png +0 -0
  36. data/doc/index.html +82 -0
  37. data/doc/js/darkfish.js +153 -0
  38. data/doc/js/jquery.js +18 -0
  39. data/doc/js/navigation.js +142 -0
  40. data/doc/js/search.js +94 -0
  41. data/doc/js/search_index.js +1 -0
  42. data/doc/js/searcher.js +228 -0
  43. data/doc/rdoc.css +543 -0
  44. data/doc/table_of_contents.html +68 -0
  45. data/lib/pwqgen.rb +0 -2
  46. data/lib/pwqgen/pwqgen.rb +31 -17
  47. data/lib/pwqgen/version.rb +1 -1
  48. data/lib/pwqgen/wordlist.rb +1 -1
  49. data/pwqgen.rb.gemspec +9 -4
  50. data/spec/lib/pwqgen_spec.rb +27 -0
  51. data/spec/spec_helper.rb +1 -0
  52. metadata +83 -6
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ = 0.0.2 / Unreleased
2
+
3
+ * Added unit tests.
4
+ * Simplified invocation. You can now just call `Pwqgen.generate`.
5
+
1
6
  = 0.0.1 / 2012-06-28
2
7
 
3
8
  * Initial release.
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source :rubygems
2
- ruby "1.9.3"
3
2
 
4
- gem 'docopt'
3
+ gemspec
@@ -0,0 +1,35 @@
1
+ # pwqgen.rb
2
+
3
+ [![Build Status](https://secure.travis-ci.org/iphoting/pwqgen.rb.png)](http://travis-ci.org/iphoting/pwqgen.rb) [![Dependency Status](https://gemnasium.com/iphoting/pwqgen.rb.png)](https://gemnasium.com/iphoting/pwqgen.rb)
4
+
5
+ pwqgen.rb is a Ruby implementation of passwdqc's pwqgen password generator.
6
+
7
+ ## Installation
8
+
9
+ ```
10
+ gem install pwqgen.rb
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### CLI
16
+ ```
17
+ $ pwqgen.rb
18
+ ```
19
+
20
+ ### Ruby App
21
+
22
+ - First, add `pwqgen.rb` into your `Gemfile`.
23
+
24
+ - Within your application, `require "pwqgen"`.
25
+
26
+ - Then, invoke `Pwqgen.generate` for a random password.
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
35
+
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ task :default => :spec
8
+ task :test => :spec
9
+
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'pwqgen'
4
3
  require 'pwqgen/version'
4
+ require 'pwqgen'
5
5
 
6
6
  doc = "Usage: pwqgen.rb [options] <length>
7
7
 
@@ -18,8 +18,9 @@ if __FILE__ == $0
18
18
  options = Docopt(doc, Pwqgen::VERSION)
19
19
 
20
20
  if ARGV.length > 0 && ARGV[0].to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) then
21
- p Pwqgen::Generator.new.generate(ARGV[0].to_i)
21
+ p Pwqgen.generate(ARGV[0].to_i)
22
22
  else
23
- p Pwqgen::Generator.new.generate
23
+ p Pwqgen.generate
24
24
  end
25
25
  end
26
+
@@ -0,0 +1,89 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>ChangeLog - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./ChangeLog.html">ChangeLog</a>
53
+
54
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
55
+
56
+ </ul>
57
+ </nav>
58
+
59
+ <nav id="classindex-section" class="section project-section">
60
+ <h3 class="section-header">Class and Module Index</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+ <li><a href="./Pwqgen.html">Pwqgen</a>
65
+
66
+ <li><a href="./Pwqgen/Generator.html">Pwqgen::Generator</a>
67
+
68
+ </ul>
69
+ </nav>
70
+
71
+ </div>
72
+ </nav>
73
+
74
+ <div id="documentation" class="description">
75
+
76
+ <h1 id="label-0.0.1+%2F+2012-06-28">0.0.1 / 2012-06-28</h1>
77
+
78
+ <pre>* Initial release.</pre>
79
+
80
+ </div>
81
+
82
+
83
+
84
+ <footer id="validator-badges">
85
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
86
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
87
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
88
+ </footer>
89
+
@@ -0,0 +1,89 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Gemfile - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./ChangeLog.html">ChangeLog</a>
53
+
54
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
55
+
56
+ </ul>
57
+ </nav>
58
+
59
+ <nav id="classindex-section" class="section project-section">
60
+ <h3 class="section-header">Class and Module Index</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+ <li><a href="./Pwqgen.html">Pwqgen</a>
65
+
66
+ <li><a href="./Pwqgen/Generator.html">Pwqgen::Generator</a>
67
+
68
+ </ul>
69
+ </nav>
70
+
71
+ </div>
72
+ </nav>
73
+
74
+ <div id="documentation" class="description">
75
+
76
+ <p>source :rubygems ruby “1.9.3”</p>
77
+
78
+ <p>gem ‘docopt’</p>
79
+
80
+ </div>
81
+
82
+
83
+
84
+ <footer id="validator-badges">
85
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
86
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
87
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
88
+ </footer>
89
+
@@ -0,0 +1,217 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module Pwqgen - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/pwqgen.rb
51
+ <li>lib/pwqgen/pwqgen.rb
52
+ <li>lib/pwqgen/wordlist.rb
53
+ <li>lib/pwqgen/version.rb
54
+ </ul>
55
+ </nav>
56
+
57
+
58
+ </div>
59
+
60
+ <div id="class-metadata">
61
+
62
+
63
+
64
+
65
+ </div>
66
+
67
+ <div id="project-metadata">
68
+ <nav id="fileindex-section" class="section project-section">
69
+ <h3 class="section-header">Pages</h3>
70
+
71
+ <ul>
72
+
73
+ <li class="file"><a href="./ChangeLog.html">ChangeLog</a>
74
+
75
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
76
+
77
+ </ul>
78
+ </nav>
79
+
80
+ <nav id="classindex-section" class="section project-section">
81
+ <h3 class="section-header">Class and Module Index</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="./Pwqgen.html">Pwqgen</a>
86
+
87
+ <li><a href="./Pwqgen/Generator.html">Pwqgen::Generator</a>
88
+
89
+ </ul>
90
+ </nav>
91
+
92
+ </div>
93
+ </nav>
94
+
95
+ <div id="documentation">
96
+ <h1 class="module">module Pwqgen</h1>
97
+
98
+ <div id="description" class="description">
99
+
100
+ <p>Public: <a href="Pwqgen.html">Pwqgen</a> is a Ruby implementation of
101
+ passwdqc’s pwqgen password generator.</p>
102
+
103
+ <p>Example</p>
104
+
105
+ <pre class="ruby"><span class="ruby-constant">Pwqgen</span><span class="ruby-operator">::</span><span class="ruby-constant">Generator</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">generate</span>
106
+ <span class="ruby-comment"># =&gt; &quot;Crime2Behave=growth&quot;</span>
107
+
108
+ <span class="ruby-constant">Pwqgen</span><span class="ruby-operator">::</span><span class="ruby-constant">Generator</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">generate</span> <span class="ruby-value">4</span>
109
+ <span class="ruby-comment"># =&gt; &quot;Caesar-Madam7draft8choose&quot;</span>
110
+ </pre>
111
+
112
+ <p>Private: Wordlist stolen from passwdqc’s wordset_4k.c. <a
113
+ href="http://www.openwall.com/passwdqc/">www.openwall.com/passwdqc/</a></p>
114
+
115
+ <p>4096 English words for generation of easy to memorize random passphrases.
116
+ This list comes from the MakePass passphrase generator developed by
117
+ Dianelos Georgoudis &lt;dianelos at tecapro.com&gt;, which was announced on
118
+ sci.crypt on 1997/10/24. Here’s a relevant excerpt from that posting:</p>
119
+
120
+ <p>&gt; The 4096 words in the word list were chosen according to the following
121
+ &gt; criteria: &gt; - each word must contain between 3 and 6 characters
122
+ &gt; - each word must be a common English word &gt; - each word
123
+ should be clearly different from each other &gt; word,
124
+ orthographically or semantically &gt; &gt; The MakePass word list has been
125
+ placed in the public domain</p>
126
+
127
+ <p>At least two other sci.crypt postings by Dianelos Georgoudis also state
128
+ that the word list is in the public domain, and so did the web page at:</p>
129
+
130
+ <p><a
131
+ href="http://web.archive.org/web/%2a/http://www.tecapro.com/makepass.html">web.archive.org/web/%2a/http://www.tecapro.com/makepass.html</a></p>
132
+
133
+ <p>which existed until 2006 and is available from the Wayback Machine as of
134
+ this writing (March 2010). Specifically, the web page said:</p>
135
+
136
+ <p>&gt; The MakePass word list has been placed in the public domain. To
137
+ download &gt; a copy click here. You can use the MakePass word list for
138
+ many other &gt; purposes.</p>
139
+
140
+ <p>“To download a copy click here” was a link to free/makepass.lst, which is
141
+ currently available via the Wayback Machine:</p>
142
+
143
+ <p><a
144
+ href="http://web.archive.org/web/%2a/http://www.tecapro.com/free/makepass.lst">web.archive.org/web/%2a/http://www.tecapro.com/free/makepass.lst</a></p>
145
+
146
+ <p>Even though the original description of the list stated that “each word
147
+ must contain between 3 and 6 characters”, there were two 7-character words:
148
+ “England” and “Germany”. For use in passwdqc, these have been replaced
149
+ with “erase” and “gag”.</p>
150
+
151
+ <p>The code in passwdqc_check.c and passwdqc_random.c makes the following
152
+ assumptions about this list:</p>
153
+ <ul><li>
154
+ <p>there are exactly 4096 words;</p>
155
+ </li><li>
156
+ <p>the words are of up to 6 characters long;</p>
157
+ </li><li>
158
+ <p>although some words may contain capital letters, no two words differ by</p>
159
+ </li></ul>
160
+
161
+ <p>the case of characters alone (e.g., converting the list to all-lowercase
162
+ would yield a list of 4096 unique words);</p>
163
+ <ul><li>
164
+ <p>the words contain alphabetical characters only;</p>
165
+ </li><li>
166
+ <p>if an entire word on this list matches the initial substring of other</p>
167
+ </li></ul>
168
+
169
+ <p>word(s) on the list, it is placed immediately before those words (e.g.,
170
+ “bake”, “baker”, “bakery”).</p>
171
+
172
+ <p>Additionally, the default minimum passphrase length of 11 characters
173
+ specified in passwdqc_parse.c has been chosen such that a passphrase
174
+ consisting of any three words from this list with two separator characters
175
+ will pass the minimum length check. In other words, this default assumes
176
+ that no word is shorter than 3 characters.</p>
177
+
178
+ </div><!-- description -->
179
+
180
+
181
+
182
+
183
+ <section id="5Buntitled-5D" class="documentation-section">
184
+
185
+
186
+
187
+
188
+
189
+ <!-- Constants -->
190
+ <section id="constants-list" class="section">
191
+ <h3 class="section-header">Constants</h3>
192
+ <dl>
193
+
194
+ <dt id="VERSION">VERSION
195
+
196
+ <dd class="description">
197
+
198
+
199
+ </dl>
200
+ </section>
201
+
202
+
203
+
204
+
205
+ <!-- Methods -->
206
+
207
+ </section><!-- 5Buntitled-5D -->
208
+
209
+ </div><!-- documentation -->
210
+
211
+
212
+ <footer id="validator-badges">
213
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
214
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
215
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
216
+ </footer>
217
+