pwqgen.rb 0.0.3.pre.1 → 0.0.3.pre.2
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.
- data/.travis.yml +5 -0
- data/ChangeLog +3 -0
- data/lib/pwqgen/pwqgen.rb +5 -4
- data/lib/pwqgen/version.rb +1 -1
- metadata +2 -2
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
* Improved CLI output.
|
4
4
|
* `Pwqgen.new` now works.
|
5
5
|
* Updated documentation with better usage examples.
|
6
|
+
* Forked and included docopt.rb, to workaround overly high rubygems
|
7
|
+
version requirement.
|
8
|
+
* Use a high-quality, secure random number generator.
|
6
9
|
|
7
10
|
= 0.0.2 / 2012-06-29
|
8
11
|
|
data/lib/pwqgen/pwqgen.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pwqgen/wordlist'
|
2
|
+
require 'securerandom'
|
2
3
|
|
3
4
|
# Public: Pwqgen is a Ruby implementation of passwdqc's pwqgen password
|
4
5
|
# generator.
|
@@ -45,7 +46,7 @@ module Pwqgen
|
|
45
46
|
@@wordlist_size = @@wordlist.length
|
46
47
|
@@separators = "-_!$&*+=23456789".split(//)
|
47
48
|
@@separators_size = @@separators.length
|
48
|
-
@rand =
|
49
|
+
@rand = SecureRandom
|
49
50
|
end
|
50
51
|
|
51
52
|
# Public: Returns a random generated password string.
|
@@ -64,10 +65,10 @@ module Pwqgen
|
|
64
65
|
def generate(length = 3)
|
65
66
|
output = Array.new
|
66
67
|
for i in 1..length
|
67
|
-
output << @@wordlist[@rand.
|
68
|
-
output[i-1] = output[i-1].capitalize if @rand.
|
68
|
+
output << @@wordlist[@rand.random_number(@@wordlist_size)]
|
69
|
+
output[i-1] = output[i-1].capitalize if @rand.random_number(2)
|
69
70
|
|
70
|
-
output << @@separators[@rand.
|
71
|
+
output << @@separators[@rand.random_number(@@separators_size)] unless i == length
|
71
72
|
end
|
72
73
|
output.join
|
73
74
|
end
|
data/lib/pwqgen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwqgen.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3.pre.
|
4
|
+
version: 0.0.3.pre.2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|