Giter VIP home page Giter VIP logo

zxcvbn-cs's Introduction

Zxcvbn C#/.NET

This is a port of the Zxcvbn JavaScript password strength estimation library at https://github.com/lowe/zxcvbn to .NET, written in C#.

From the Zxcvbn readme:

zxcvbn, named after a crappy password, is a JavaScript password strength estimation library. Use it to implement a custom strength bar on a signup form near you!

zxcvbn attempts to give sound password advice through pattern matching and conservative entropy calculations. It finds 10k common passwords, common American names and surnames, common English words, and common patterns like dates, repeats (aaa), sequences (abcd), and QWERTY patterns.

For full motivation, see:

http://tech.dropbox.com/?p=165

This port aims to produce comparable results with the JS version of Zxcvbn. The results structure that is returned can be interpreted in the same way as with JS Zxcvbn and this port has been tested with a variety of passwords to ensure that it return the same results as the JS version.

There are some implementation differences, however, so exact results are not guaranteed.

Using Zxcvbn-cs

The included Visual Studio project will create a single assembly, Zxcvbn.dll, which is all that is required to be included in your project.

To evaluate a single password:

using Zxcvbn;

//...

var result = Zxcvbn.MatchPassword("p@ssw0rd");

To evaluate many passwords, create an instance of Zxcvbn and then use that to evaluate your passwords. This avoids reloading dictionaries etc. for every password:

using Zxcvbn;

//...

var zx = new Zxcvbn();

foreach (var password in passwords)
{
	var result = zx.EvaluatePassword(password);

	//...
}

Both MatchPassword and EvaluatePassword take an optional second parameter that contains an enumerable of user data strings to also match the password against.

Interpreting Results

The Result structure returned from password evaluation is interpreted the same way as with JS Zxcvbn:

  • result.Entropy: bits of entropy for the password
  • result.CrackTime: an estimation of actual crack time, in seconds.
  • result.CrackTimeDisplay: the crack time, as a friendlier string: "instant", "6 minutes", "centuries", etc.
  • result.Score: [0,1,2,3,4] if crack time is less than [10**2, 10**4, 10**6, 10**8, Infinity]. (useful for implementing a strength bar.)
  • result.MatchSequence: the list of pattern matches that was used to calculate Entropy.
  • result.CalculationTime: how long Zxcvbn took to calculate the results.

More Information

For more information on why password entropy is calculated as it is, refer to Zxcvbns originators:

https://github.com/lowe/zxcvbn

http://tech.dropbox.com/?p=165

Licence

Since Zxcvbn-cs is a port of the original Zxcvbn the original copyright and licensing applies. Cf. the LICENSE file.

zxcvbn-cs's People

Contributors

chevalinator avatar mickford avatar bitbeans avatar

Watchers

James Cloos avatar Igor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.