Giter VIP home page Giter VIP logo

csbcrypt's Introduction

csBCrypt

Description

csBCrypt is an implementation the OpenBSD Blowfish password hashing algorithm, as described in "A Future-Adaptable Password Scheme" by Niels Provos and David Mazieres: http://www.openbsd.org/papers/bcrypt-paper.ps

This system hashes passwords using a version of Bruce Schneier's Blowfish block cipher with modifications designed to raise the cost of off-line password cracking. The computation cost of the algorithm is parameterised, so it can be increased as computers get faster.

Testing

NUnit regression tests are available in TestBCrypt.cs

References

A simple example that demonstrates most of the features:

// Hash a password for the first time
string hashed = BCrypt.CreateHash(password, BCrypt.GenerateSalt());

// GenerateSalt's log_rounds parameter determines the complexity
// the work factor is 2**log_rounds, and the default is 10
string hashed = BCrypt.CreateHash(password, BCrypt.GenerateSalt(12));

// Check that an unencrypted password matches one that has
// previously been hashed
if (BCrypt.VerifyPlaintext(candidate, hashed))
	Console.WriteLine("It matches");
else
	Console.WriteLine("It does not match");

Contributing

Please report bugs to this repository as a new issue.

To add a new feature:

  1. Fork this repository.
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

ISC/BSD License. See LICENSE.txt file.

Contributors

Port Information

This repository is based off of version 0.4 of jBCrypt found here: http://www.mindrot.org/projects/jBCrypt/

I have also mirrored all versions of jBCrypt on a personal repository found here: https://github.com/chriswebb/jBCrypt/

BCrypt.Net is based off of the same repository, but was not used in the making of this port. So this is not a fork of BCrypt.Net. This is a standalone port of jBCrypt.

csbcrypt's People

Contributors

chriswebb avatar

Watchers

James Cloos avatar  avatar

csbcrypt's Issues

Problem with 2y type hash bcrypt

Hello, I'm starting with csBCrypt to create hashs using pre-generated salt (read from api rest, wsse).

I have a problem with hash like this:
**$2y$**09$WTSOX59Dqr/Xo5DF/yPfUuSuARsNVlQYENiVBbAKlW/UrDUL.Z772

Symfony2 encoder use this type of hash instead of $2a. csBCrypt generate an Exception:
Additional information: Invalid salt revision

I have been reading and seemed that 2y and 2a is ¿compatible? ¿equal? (don't know). This works:
hashed = BCrypt.CreateHash(passwd, salt.Replace(@"$2y$", @"$2a$")).Replace(@"$2a$", @"$2y$");

Do you have any cloud about 2y code in a bcrypt hash??
Thanks chriswebb

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.