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.
@@ -73,4 +73,4 @@ module StrongPassword
73
73
  end
74
74
  end
75
75
  end
76
- end
76
+ end
@@ -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.dup.downcase]
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.dup.downcase
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.dup.downcase
136
+ password = password.downcase
137
137
  variants = []
138
138
 
139
139
  leet = password.tr(LEET_SPEAK_1.keys.join, LEET_SPEAK_1.values.join)
@@ -20,7 +20,7 @@ module StrongPassword
20
20
  attr_reader :base_password
21
21
 
22
22
  def initialize(password)
23
- @base_password = password.dup.downcase
23
+ @base_password = password.downcase
24
24
  end
25
25
 
26
26
  def is_strong?(min_entropy: 18)
@@ -1,3 +1,3 @@
1
1
  module StrongPassword
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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.3125, # Even if there are multiple words
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' => 16, # But only drops the first matched word
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' => true,
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 be(strength)
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 be(strength)
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 be(strength)
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.3
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: 2013-06-27 00:00:00.000000000 Z
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.3
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