lib/strong_password/qwerty_adjuster.rb
# Returns the minimum entropy for the password's qwerty locality
# adjustments.  If a threshhold is specified we will bail
# early to avoid unnecessary processing.
Returns the minimum entropy for the password's qwerty locality
adjustments.  If a threshhold is specified we will bail
early to avoid unnecessary processing.
Returns the minimum entropy for the password ' s qwerty locality adjustments . If a threshhold is specified we will bail early to avoid unnecessary processing .
def adjusted_entropy(base_password)
      revpassword = base_password.reverse
      lowest_entropy = [EntropyCalculator.calculate(base_password), EntropyCalculator.calculate(revpassword)].min
      return lowest_entropy if lowest_entropy < entropy_threshhold
      qpassword = mask_qwerty_strings(base_password)
      lowest_entropy = [lowest_entropy, EntropyCalculator.calculate(qpassword)].min if qpassword != base_password
      return lowest_entropy if lowest_entropy < entropy_threshhold
      qrevpassword = mask_qwerty_strings(revpassword)
      lowest_entropy = [lowest_entropy, EntropyCalculator.calculate(qrevpassword)].min if qrevpassword != revpassword
      lowest_entropy
    end
def adjusted_entropy ( base_password ) revpassword = base_password . reverse lowest_entropy = [ EntropyCalculator . calculate ( base_password ) , EntropyCalculator . calculate ( revpassword ) ] . min return lowest_entropy if lowest_entropy < entropy_threshhold qpassword = mask_qwerty_strings ( base_password ) lowest_entropy = [ lowest_entropy , EntropyCalculator . calculate ( qpassword ) ] . min if qpassword != base_password return lowest_entropy if lowest_entropy < entropy_threshhold qrevpassword = mask_qwerty_strings ( revpassword ) lowest_entropy = [ lowest_entropy , EntropyCalculator . calculate ( qrevpassword ) ] . min if qrevpassword != revpassword lowest_entropy end
Returns the minimum entropy for the password's qwerty locality
adjustments.
Returns the minimum entropy for the password ' s qwerty locality adjustments .
# If our entropy is already lower than we care about then there's no reason to look further. # Bail early if our entropy on the base password's masked qwerty value is less than our threshold.
base_password
<not_specific>