strong_password 0.0.3 → 0.0.4
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 +4 -4
- data/CHANGELOG +7 -0
- data/README.md +1 -1
- data/lib/strong_password/dictionary_adjuster.rb +971 -88
- data/lib/strong_password/entropy_calculator.rb +1 -1
- data/lib/strong_password/password_variants.rb +3 -3
- data/lib/strong_password/qwerty_adjuster.rb +1 -1
- data/lib/strong_password/version.rb +1 -1
- data/spec/strong_password/dictionary_adjuster_spec.rb +2 -2
- data/spec/strong_password/strength_checker_spec.rb +5 -4
- metadata +3 -3
@@ -108,7 +108,7 @@ module StrongPassword
|
|
108
108
|
|
109
109
|
# Returns all variants of a given password including the password itself
|
110
110
|
def self.all_variants(password)
|
111
|
-
passwords = [password.
|
111
|
+
passwords = [password.downcase]
|
112
112
|
passwords += keyboard_shift_variants(password)
|
113
113
|
passwords += leet_speak_variants(password)
|
114
114
|
passwords.uniq
|
@@ -116,7 +116,7 @@ module StrongPassword
|
|
116
116
|
|
117
117
|
# Returns all keyboard shifted variants of a given password
|
118
118
|
def self.keyboard_shift_variants(password)
|
119
|
-
password = password.
|
119
|
+
password = password.downcase
|
120
120
|
variants = []
|
121
121
|
|
122
122
|
if (password == password.tr(KEYBOARDMAP_DOWN_NOSHIFT.keys.join, KEYBOARDMAP_DOWN_NOSHIFT.values.join))
|
@@ -133,7 +133,7 @@ module StrongPassword
|
|
133
133
|
|
134
134
|
# Returns all leet speak variants of a given password
|
135
135
|
def self.leet_speak_variants(password)
|
136
|
-
password = password.
|
136
|
+
password = password.downcase
|
137
137
|
variants = []
|
138
138
|
|
139
139
|
leet = password.tr(LEET_SPEAK_1.keys.join, LEET_SPEAK_1.values.join)
|
@@ -40,9 +40,9 @@ module StrongPassword
|
|
40
40
|
'h#e0zbPas' => 19.5, # Random string should not get adjusted by dictionary adjuster
|
41
41
|
'password' => 4, # Adjusts common dictionary words
|
42
42
|
'E_!3password' => 11.5, # Adjusts common dictionary words regardless of placement
|
43
|
-
'h#e0zbPas 32e2i81 password' => 31.
|
43
|
+
'h#e0zbPas 32e2i81 password' => 31.0625, # Even if there are multiple words
|
44
44
|
'123456' => 4, # Even if they are also qwerty strings
|
45
|
-
'password123456' =>
|
45
|
+
'password123456' => 14, # But only drops the first matched word
|
46
46
|
'asdf)asdf' => 14, # Doesn't break with parens
|
47
47
|
'asdf[]asdf' => 16 # Doesn't break with []s
|
48
48
|
}.each do |password, bits|
|
@@ -21,11 +21,12 @@ module StrongPassword
|
|
21
21
|
'blahblah' => true,
|
22
22
|
'password' => false,
|
23
23
|
'wwwwwwww' => false,
|
24
|
-
'adamruge' =>
|
24
|
+
'adamruge' => false,
|
25
|
+
'madaegur' => true,
|
25
26
|
'aB$1' => false
|
26
27
|
}.each do |password, strength|
|
27
28
|
it "is_strong? returns #{strength} for '#{password}' with 12 bits of entropy" do
|
28
|
-
expect(StrengthChecker.new(password).is_strong?(min_entropy: 12, use_dictionary: true)).to
|
29
|
+
expect(StrengthChecker.new(password).is_strong?(min_entropy: 12, use_dictionary: true)).to eq(strength)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
@@ -40,7 +41,7 @@ module StrongPassword
|
|
40
41
|
'correct horse battery staple' => true
|
41
42
|
}.each do |password, strength|
|
42
43
|
it "is_strong? returns #{strength} for '#{password}' with standard bits of entropy" do
|
43
|
-
expect(StrengthChecker.new(password).is_strong?(use_dictionary: true)).to
|
44
|
+
expect(StrengthChecker.new(password).is_strong?(use_dictionary: true)).to eq(strength)
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
@@ -56,7 +57,7 @@ module StrongPassword
|
|
56
57
|
'c0rr#ct h0rs3 Batt$ry st@pl3 is Gr34t' => true
|
57
58
|
}.each do |password, strength|
|
58
59
|
it "is_strong? returns #{strength} for '#{password}' with standard bits of entropy" do
|
59
|
-
expect(StrengthChecker.new(password).is_strong?(min_entropy: 40, use_dictionary: true)).to
|
60
|
+
expect(StrengthChecker.new(password).is_strong?(min_entropy: 40, use_dictionary: true)).to eq(strength)
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian McManus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.0
|
108
|
+
rubygems_version: 2.2.0
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: StrongPassword adds a class to check password strength and a validator for
|