Skip to content

mosrahman/BCrypt.Net-PCL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

BCrypt.Net-PCL

BCrypt.Net-PCL is a Universal Encryption(Blowfish) utility for Windows, Universal Windows Application, Windows IoT Core, Store Application, Phone, Asp.Net Web Application and Xamarin.

How to use it

Add reference to your code like-

using BCrypt.Net;
using BCrypt = BCrypt.Net.BCrypt;

To hash a password for the first time, call the HashPassword() method with a random salt, like-

string pass =  global::BCrypt.Net.BCrypt.HashPassword("password", global::BCrypt.Net.BCrypt.GenerateSalt());

To check whether a plain text password matches one that has been hashed previously, use the CheckPassword() method-

if (global::BCrypt.Net.BCrypt.CheckPassword("password", pass)) 
{
  Console.WriteLine("Match");
} 
else 
{
  Console.WriteLine("Don’t Match");
}

The GenerateSalt() method takes an optional integer parameter that determines the computational complexity of the hashing

string SaltStrong30 = global::BCrypt.Net.BCrypt.GenerateSalt(30);
string SaltStrong31 = global::BCrypt.Net.BCrypt.GenerateSalt(31);

The amount of work increases exponentially (2**number). The default number is 10, and the valid range is 4 to 31.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages