Example #1
0
        private void key(byte[] key)
        {
            uint[] numArray = new uint[2];
            int    length   = (int)this.p.Length;
            int    num      = (int)this.s.Length;
            int    num1     = 0;

            for (int i = 0; i < length; i++)
            {
                this.p[i] ^= BCrypt.streamToWord(key, ref num1);
            }
            for (int j = 0; j < length; j += 2)
            {
                this.encipher(numArray, 0);
                this.p[j]     = numArray[0];
                this.p[j + 1] = numArray[1];
            }
            for (int k = 0; k < num; k += 2)
            {
                this.encipher(numArray, 0);
                this.s[k]     = numArray[0];
                this.s[k + 1] = numArray[1];
            }
        }
Example #2
0
 public string HashPassword(string password)
 {
     return(BCrypt.HashPassword(password, BCrypt.GenerateSalt()));
 }
Example #3
0
 public bool CheckPassword(string password, string hashed)
 {
     return(BCrypt.CheckPassword(password, hashed));
 }
Example #4
0
 public static bool CheckPassword(string plaintext, string hashed)
 {
     return(StringComparer.Ordinal.Compare(hashed, BCrypt.HashPassword(plaintext, hashed)) == 0);
 }
Example #5
0
 public static string GenerateSalt()
 {
     return(BCrypt.GenerateSalt(10));
 }