xchange-passgen 1.0.1.a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +13 -0
- data/Manifest +11 -0
- data/README.rdoc +156 -0
- data/Rakefile +15 -0
- data/init.rb +2 -0
- data/lib/passgen/probabilities.rb +804 -0
- data/lib/passgen/strength_analyzer.rb +282 -0
- data/lib/passgen.rb +328 -0
- data/passgen.gemspec +30 -0
- data/spec/passgen/strength_analyzer_spec.rb +75 -0
- data/spec/passgen_spec.rb +150 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7b676c12f955a57039cd9c343f0acc6f40bee118f4f4155f050584c0ba6ee658
|
4
|
+
data.tar.gz: 91659d46ed020ea421357734e35d90b63273273a1d86682f5247450c1b940479
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 372a3386e52d1a6011ed5fd2b89211e5d38e45eef7ebfac9d8908eb48963ed6a6ed392c312988f0740a07750c69ddc33a042ea659750528e0af684d3d9f8ac23
|
7
|
+
data.tar.gz: fdd8ffa68c5c139957608c9240005811849a22439107cac9eaec312527f1a5a813118618d37f617fc8dd528450464d58a68dca946d2f9a7f4ec1e6391a98c18d
|
data/CHANGELOG
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
v1.0.1 Corrected syntax error with ruby1.9.2
|
2
|
+
|
3
|
+
v1.0.0. Added password strength analyzer
|
4
|
+
|
5
|
+
v0.9.1. Had not added new files in 0.9.0 version
|
6
|
+
|
7
|
+
v0.9.0. Added pronounceable passwords
|
8
|
+
|
9
|
+
v0.1.3. Updated help
|
10
|
+
|
11
|
+
v0.1.2. Moved to rubygems.org
|
12
|
+
|
13
|
+
v0.1.1. First public release
|
data/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
= Passgen
|
2
|
+
|
3
|
+
Ruby gem for generating passwords quickly and easily. Although it is
|
4
|
+
suitable for use within Rails it has no Rails dependencies and can be used in
|
5
|
+
non-Rails applications as well.
|
6
|
+
|
7
|
+
It can generate passwords including lower case, upper case, digits and symbols and also
|
8
|
+
pronounceable passwords.
|
9
|
+
|
10
|
+
Since 1.0.0 you can also analyze the quality of a password, both as a numeric score
|
11
|
+
between 0 and 100 and as a complexity ranking.
|
12
|
+
|
13
|
+
== Install
|
14
|
+
|
15
|
+
gem install passgen
|
16
|
+
|
17
|
+
== Usage
|
18
|
+
|
19
|
+
The usage could not be easier. Just require and call the generate method:
|
20
|
+
|
21
|
+
>> require 'rubygems'
|
22
|
+
>> require 'passgen'
|
23
|
+
>> Passgen::generate
|
24
|
+
=> "zLWCeS3xC9"
|
25
|
+
|
26
|
+
You check the strength of a password by calling analyze:
|
27
|
+
|
28
|
+
>> info = Passgen::analyze("zLWCeS3xC9")
|
29
|
+
=> #<Passgen::StrengthAnalyzer:0xb728654c @complexity="Strong", @score=78, @errors=[], @password="zLWCeS3xC9">
|
30
|
+
>> info.score
|
31
|
+
=> 78
|
32
|
+
>> info.complexity
|
33
|
+
=> "Strong"
|
34
|
+
|
35
|
+
== Examples
|
36
|
+
|
37
|
+
>> Passgen::generate
|
38
|
+
=> "zLWCeS3xC9"
|
39
|
+
|
40
|
+
>> Passgen::generate(:length => 20)
|
41
|
+
=> "6lCcHvkuEW6OuzAtkoAs"
|
42
|
+
|
43
|
+
>> Passgen::generate(:symbols => true)
|
44
|
+
=> "gr)$6bIym1"
|
45
|
+
|
46
|
+
>> Passgen::generate(:lowercase => :only)
|
47
|
+
=> "ysbwuxbcea"
|
48
|
+
|
49
|
+
>> Passgen::generate(:number => 3)
|
50
|
+
=> ["REdOigTkdI", "PQu8DsV9WZ", "qptKLbw8YQ"]
|
51
|
+
|
52
|
+
>> Passgen::generate(:seed => 5)
|
53
|
+
=> "JoV9M2qjiK"
|
54
|
+
>> Passgen::generate(:seed => 5) # Will generate same password again
|
55
|
+
=> "JoV9M2qjiK"
|
56
|
+
|
57
|
+
>> Passgen::generate(:pronounceable => true) # Pronounceable, mixed case password
|
58
|
+
=> "ActeodEuRT"
|
59
|
+
>> Passgen::generate(:pronounceable => true, :lowercase => :only) # Pronounceable lower case
|
60
|
+
=> "terysolang"
|
61
|
+
>> Passgen::generate(:pronounceable => true, :uppercase => :only) # Pronounceable upper case
|
62
|
+
=> "ACTOPECHEI"
|
63
|
+
>> Passgen::generate(:pronounceable => true, :digits_before => 3) # Pad with digits in front
|
64
|
+
=> "886uRApLIN"
|
65
|
+
>> Passgen::generate(:pronounceable => true, :digits_before => 3) # Pad with digits at the end
|
66
|
+
=> "uRAPLIN886"
|
67
|
+
|
68
|
+
== Options:
|
69
|
+
|
70
|
+
=== :lowercase => true/false/:only
|
71
|
+
* true - Use lowercase letters in the generated password.
|
72
|
+
* false - Do not use lowercase letters in the generated password.
|
73
|
+
* :only - Only use lowercase letters in the generated password.
|
74
|
+
|
75
|
+
=== :uppercase => true/false/:only
|
76
|
+
* true - Use uppercase letters in the generated password.
|
77
|
+
* false - Do not use uppercase letters in the generated password.
|
78
|
+
* :only - Only use uppercase letters in the generated password.
|
79
|
+
|
80
|
+
=== :digits => true/false/:only
|
81
|
+
* true - Use digits in the generated password.
|
82
|
+
* false - Do not use digits in the generated password.
|
83
|
+
* :only - Only use digits in the generated password.
|
84
|
+
|
85
|
+
=== :symbols => true/false/:only/:list
|
86
|
+
* true - Use symbols in the generated password.
|
87
|
+
* false - Do not use symbols in the generated password.
|
88
|
+
* :only - Only use symbols in the generated password.
|
89
|
+
* :list - A string with the symbols to use. Not implemented yet.
|
90
|
+
|
91
|
+
=== :number => integer
|
92
|
+
Number of passwords to generate. If >1 the result is an Array.
|
93
|
+
|
94
|
+
=== :length => integer/range
|
95
|
+
The number of characters in the generated passwords. A range results in passwords
|
96
|
+
lengths within the given range.
|
97
|
+
|
98
|
+
=== :seed => integer/:default
|
99
|
+
Set the srand seed to the given integer prior to generating the passwords.
|
100
|
+
|
101
|
+
=== :pronounceable => true/false
|
102
|
+
* true - Generate pronounceable passwords
|
103
|
+
* false - No effect
|
104
|
+
|
105
|
+
=== :digits_after => true/number (Only in combination with :pronounceable)
|
106
|
+
* Pads the pronounceable password with number digits at the end. Defaults to 2 if true is passed.
|
107
|
+
|
108
|
+
=== :digits_before => true/number (Only in combination with :pronounceable)
|
109
|
+
* Pads the pronounceable password with number digits in front. Defaults to 2 if true is passed.
|
110
|
+
|
111
|
+
=== Default values:
|
112
|
+
|
113
|
+
:lowercase => true
|
114
|
+
|
115
|
+
:uppercase => true
|
116
|
+
|
117
|
+
:digits => true
|
118
|
+
|
119
|
+
:symbols => false
|
120
|
+
|
121
|
+
:pronounceable => Not implemented yet.
|
122
|
+
|
123
|
+
:number => 1
|
124
|
+
|
125
|
+
:length => 10
|
126
|
+
|
127
|
+
:seed => nil
|
128
|
+
|
129
|
+
:pronounceable => false
|
130
|
+
|
131
|
+
:digits_after => 2 (Only in combination with pronounceable)
|
132
|
+
|
133
|
+
:digits_before => 2 (Only in combination with pronounceable)
|
134
|
+
|
135
|
+
== Copyright and license
|
136
|
+
|
137
|
+
Copyright (c) 2009-2010 Erik Lindblad
|
138
|
+
|
139
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
140
|
+
a copy of this software and associated documentation files (the
|
141
|
+
"Software"), to deal in the Software without restriction, including
|
142
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
143
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
144
|
+
permit persons to whom the Software is furnished to do so, subject to
|
145
|
+
the following conditions:
|
146
|
+
|
147
|
+
The above copyright notice and this permission notice shall be
|
148
|
+
included in all copies or substantial portions of the Software.
|
149
|
+
|
150
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
151
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
152
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
153
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
154
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
155
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
156
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Rakefile
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
require 'echoe'
|
5
|
+
|
6
|
+
Echoe.new('passgen', '1.0.1') do |p|
|
7
|
+
p.description = "A password generation gem for Ruby and Rails applications."
|
8
|
+
p.url = "http://github.com/cryptice/passgen"
|
9
|
+
p.author = "Erik Lindblad"
|
10
|
+
p.email = "erik@l2c.se"
|
11
|
+
p.ignore_pattern = ["tmp/*", "script/*", "nbproject/*"]
|
12
|
+
p.development_dependencies = []
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/init.rb
ADDED