pwfoo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +0 -1
- data/README.rdoc +21 -1
- data/Rakefile +23 -2
- data/lib/pwfoo.rb +1 -1
- data/lib/pwfoo/generate_password.rb +12 -1
- data/lib/pwfoo/password_score_calculator.rb +5 -0
- data/lib/pwfoo/password_strength.rb +13 -0
- data/lib/pwfoo/srand_seed_generator.rb +8 -1
- data/pwfoo.gemspec +3 -3
- data/spec/pwfoo/generates_password_spec.rb +0 -1
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
data/Manifest
CHANGED
@@ -10,7 +10,6 @@ lib/pwfoo/generate_password.rb
|
|
10
10
|
lib/pwfoo/password_score_calculator.rb
|
11
11
|
lib/pwfoo/password_strength.rb
|
12
12
|
lib/pwfoo/srand_seed_generator.rb
|
13
|
-
pwfoo.gemspec
|
14
13
|
spec/pwfoo/generates_password_spec.rb
|
15
14
|
spec/pwfoo/password_score_calculator_spec.rb
|
16
15
|
spec/pwfoo/random_seed_generator_spec.rb
|
data/README.rdoc
CHANGED
@@ -1,3 +1,23 @@
|
|
1
1
|
= pwfoo
|
2
2
|
|
3
|
-
|
3
|
+
pwfoo is a gem that provides random password generation, password strength calculation, and a random seed generator.
|
4
|
+
|
5
|
+
== Examples
|
6
|
+
Generate password of length *12* with lower case, upper case, numbers, and special characters with a minimum strength score of *80*:
|
7
|
+
|
8
|
+
require 'generate_password'
|
9
|
+
generate_password = PwFoo::GeneratePassword.new(12, PwFoo::GeneratePassword.LOWER_CASE, PwFoo::GeneratePassword.UPPER_CASE, PwFoo::GeneratePassword.NUMBERS, PwFoo::GeneratePassword.SPECIALS )
|
10
|
+
my_new_password = generate_password.generate_with_min_strength 80
|
11
|
+
|
12
|
+
Determine the strength of your password:
|
13
|
+
require 'password_strength'
|
14
|
+
my_pw = 'secret'
|
15
|
+
my_pw_score = PwFoo::PasswordStrength.new.calculate_score(my_pw)
|
16
|
+
|
17
|
+
== INSTALL
|
18
|
+
$ sudo gem install gemcutter
|
19
|
+
$ gem tumble
|
20
|
+
$ sudo gem install pwfoo
|
21
|
+
or add the following to your <b>environment.rb</b>
|
22
|
+
config.gem 'pwfoo'
|
23
|
+
|
data/Rakefile
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
|
+
require 'spec'
|
5
|
+
require 'cucumber'
|
4
6
|
|
5
|
-
|
7
|
+
require 'cucumber/rake/task'
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
|
10
|
+
Echoe.new("pwfoo", "0.1.1") do |p|
|
6
11
|
p.author = "Perry Hertler"
|
7
12
|
p.summary = "A gem that generates strong random passwords, scores the strength of passwords, and generates random seeds."
|
8
13
|
p.url = "http://github.com/perry3819/pwfoo"
|
@@ -11,4 +16,20 @@ Echoe.new("pwfoo", "0.1.0") do |p|
|
|
11
16
|
p.development_dependencies = []
|
12
17
|
end
|
13
18
|
|
14
|
-
Dir["#File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
19
|
+
Dir["#File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
spec_files = Rake::FileList["spec/**/*_spec.rb"]
|
24
|
+
|
25
|
+
desc "Run specs"
|
26
|
+
Spec::Rake::SpecTask.new do |t|
|
27
|
+
t.spec_files = spec_files
|
28
|
+
t.spec_opts = ["-c"]
|
29
|
+
end
|
30
|
+
|
31
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
32
|
+
t.cucumber_opts = "features --format progress"
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => [:spec, :features]
|
data/lib/pwfoo.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# = generate_password.rb - Random Password Generator
|
2
|
+
#
|
3
|
+
# Perry Hertler mailto:perry@hertler.org
|
4
|
+
#
|
5
|
+
# == Example
|
6
|
+
#
|
7
|
+
# Generate password of length *12* with lower case, upper case, numbers, and special characters with a minimum strength score of *80*.
|
8
|
+
#
|
9
|
+
# require 'generate_password'
|
10
|
+
# generate_password = PwFoo::GeneratePassword.new(12, PwFoo::GeneratePassword.LOWER_CASE, PwFoo::GeneratePassword.UPPER_CASE, PwFoo::GeneratePassword.NUMBERS, PwFoo::GeneratePassword.SPECIALS )
|
11
|
+
# my_new_password = generate_password.generate_with_min_strength 80
|
1
12
|
module PwFoo
|
2
13
|
class GeneratePassword
|
3
14
|
LOWER_CASE = 'lower_case'
|
@@ -14,7 +25,7 @@ module PwFoo
|
|
14
25
|
|
15
26
|
def initialize(length = 10, *allowed_types)
|
16
27
|
@length = length
|
17
|
-
@allowed_types = allowed_types
|
28
|
+
@allowed_types = allowed_types.nil? || 0 == allowed_types.length ? [LOWER_CASE, UPPER_CASE, NUMBERS] : allowed_types
|
18
29
|
@pw_strength_finder = PasswordStrength.new
|
19
30
|
srand(SrandSeedGenerator.new().get_next_seed)
|
20
31
|
end
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# = password_score_calculator.rb - Calculates various password strength scores.
|
2
|
+
# This class will usually never be used directly. Instead use *PasswordStrength*.
|
3
|
+
#
|
4
|
+
# Perry Hertler mailto:perry@hertler.org
|
5
|
+
#
|
1
6
|
module PwFoo
|
2
7
|
class PasswordScoreCalculator
|
3
8
|
SYMBOLS_REGEX = /[^a-zA-Z0-9_]/
|
@@ -1,3 +1,16 @@
|
|
1
|
+
# = password_strength.rb - Password Strength Finder
|
2
|
+
#
|
3
|
+
# Perry Hertler mailto:perry@hertler.org
|
4
|
+
#
|
5
|
+
# == Example
|
6
|
+
#
|
7
|
+
# Given a password, *PasswordStrength* will calculate a strength score.
|
8
|
+
#
|
9
|
+
# *0* is the lowest score and *100* is the highest score.
|
10
|
+
#
|
11
|
+
# require 'password_strength'
|
12
|
+
# my_pw = 'secret'
|
13
|
+
# my_pw_score = PwFoo::PasswordStrength.new.calculate_score(my_pw)
|
1
14
|
module PwFoo
|
2
15
|
class PasswordStrength
|
3
16
|
def initialize
|
@@ -1,6 +1,13 @@
|
|
1
|
+
# = srand_seed_generator.rb - Random seed generator uses the system time and currently running processes to generate a highly random seed.
|
2
|
+
#
|
3
|
+
# Perry Hertler mailto:perry@hertler.org
|
4
|
+
#
|
5
|
+
# == Example
|
6
|
+
#
|
7
|
+
# my_seed = PwFoo::SrandSeedGenerator.new.get_next_seed
|
1
8
|
module PwFoo
|
2
9
|
require 'digest/md5'
|
3
|
-
|
10
|
+
|
4
11
|
class SrandSeedGenerator
|
5
12
|
def initialize
|
6
13
|
end
|
data/pwfoo.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{pwfoo}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Perry Hertler"]
|
9
|
-
s.date = %q{2009-11-
|
9
|
+
s.date = %q{2009-11-17}
|
10
10
|
s.description = %q{A gem that generates strong random passwords, scores the strength of passwords, and generates random seeds.}
|
11
11
|
s.email = %q{perry@hertler.org}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/pwfoo.rb", "lib/pwfoo/generate_password.rb", "lib/pwfoo/password_score_calculator.rb", "lib/pwfoo/password_strength.rb", "lib/pwfoo/srand_seed_generator.rb"]
|
13
|
-
s.files = ["Manifest", "README.rdoc", "Rakefile", "features/pwfoo_calculate_password_strength.feature", "features/pwfoo_generate_random_password.feature", "features/step_definitions/password_steps.rb", "features/support/env.rb", "lib/pwfoo.rb", "lib/pwfoo/generate_password.rb", "lib/pwfoo/password_score_calculator.rb", "lib/pwfoo/password_strength.rb", "lib/pwfoo/srand_seed_generator.rb", "
|
13
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "features/pwfoo_calculate_password_strength.feature", "features/pwfoo_generate_random_password.feature", "features/step_definitions/password_steps.rb", "features/support/env.rb", "lib/pwfoo.rb", "lib/pwfoo/generate_password.rb", "lib/pwfoo/password_score_calculator.rb", "lib/pwfoo/password_strength.rb", "lib/pwfoo/srand_seed_generator.rb", "spec/pwfoo/generates_password_spec.rb", "spec/pwfoo/password_score_calculator_spec.rb", "spec/pwfoo/random_seed_generator_spec.rb", "spec/spec_helper.rb", "pwfoo.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/perry3819/pwfoo}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pwfoo", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwfoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perry Hertler
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-17 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,11 +39,11 @@ files:
|
|
39
39
|
- lib/pwfoo/password_score_calculator.rb
|
40
40
|
- lib/pwfoo/password_strength.rb
|
41
41
|
- lib/pwfoo/srand_seed_generator.rb
|
42
|
-
- pwfoo.gemspec
|
43
42
|
- spec/pwfoo/generates_password_spec.rb
|
44
43
|
- spec/pwfoo/password_score_calculator_spec.rb
|
45
44
|
- spec/pwfoo/random_seed_generator_spec.rb
|
46
45
|
- spec/spec_helper.rb
|
46
|
+
- pwfoo.gemspec
|
47
47
|
has_rdoc: true
|
48
48
|
homepage: http://github.com/perry3819/pwfoo
|
49
49
|
licenses: []
|