Crypts and verifies passwords. The main class for most uses of this library.
Inheritance Hierarchy
![Online Online](./../icons/online_icon.gif)
CryptSharp Crypter
CryptSharp BlowfishCrypter
CryptSharp ExtendedDesCrypter
CryptSharp LdapCrypter
CryptSharp MD5Crypter
CryptSharp PhpassCrypter
CryptSharp ShaCrypter
CryptSharp TraditionalDesCrypter
Namespace: CryptSharp
Assembly: CryptSharp (in CryptSharp.dll) Version: 2.0.0.0
Syntax
Examples
using CryptSharp; // Crypt using the Blowfish crypt ("BCrypt") algorithm. string cryptedPassword = Crypter.Blowfish.Crypt(password);
using CryptSharp; // Do the passwords match? // You can also check a password using the Crypt method, but this approach way is easier. bool matches = Crypter.CheckPassword(testPassword, cryptedPassword);
using CryptSharp; // Specify the $apr1$ Apache htpasswd variant of the MD5 crypt algorithm. string cryptedPassword = Crypter.MD5.Crypt(password, new CrypterOptions() { { CrypterOption.Variant, MD5CrypterVariant.Apache } });
See Also