ZXCVBN v0.1.2 ZXCVBN View Source

ZXCVBN is an Elixir implemenation of ZXCVBN. The original paper is available here.

The usage is simple:

iex> ZXCVBN.zxcvbn("password")
  %{
  calc_time: 51,
  crack_times_display: %{
    offline_fast_hashing_1e10_per_second: "less than a second",
    offline_slow_hashing_1e4_per_second: "less than a second",
    online_no_throttling_10_per_second: "less than a second",
    online_throttling_100_per_hour: "1 minute"
  },
  crack_times_seconds: %{
    offline_fast_hashing_1e10_per_second: 3.0e-10,
    offline_slow_hashing_1e4_per_second: 0.0003,
    online_no_throttling_10_per_second: 0.3,
    online_throttling_100_per_hour: 108.0
  },
  feedback: %{
    suggestions: ["Add another word or two. Uncommon words are better.",
     "Predictable substitutions like '@' instead of 'a' don't help very much"],
    warning: ""
  },
  guesses: 3,
  guesses_log10: 0.47712125471966244,
  password: "password",
  score: 0,
  sequence: [
    %{
      base_guesses: 2,
      dictionary_name: :passwords,
      guesses: 2,
      guesses_log10: 0.3010299956639812,
      i: 0,
      j: 7,
      l33t: false,
      l33t_variations: 1,
      matched_word: "password",
      pattern: :dictionary,
      rank: 2,
      reversed: false,
      token: "password",
      uppercase_variations: 1
    }
  ]
}

You can also pass of list of user inputs that will act as additional dictionary. This is useful for checking if the password is not same or variant of associated user inputs.

iex> ZXCVBN.zxcvbn("nepal", ["samar", "mustang", "nepal", "hello@example.com"])

Link to this section Summary

Link to this section Functions

Link to this function

zxcvbn(string, user_inputs \\ []) View Source
zxcvbn(String.t(), [String.t()]) :: map() | :error