/// <summary> /// This method is used to call some portions of the GeneratePasswordHash /// multiple times. /// </summary> /// <param name="part1"></param> /// <param name="keyCode"></param> /// <returns></returns> private static string HashPart1(string password, string keyCode) { // initial value string part1 = ""; try { // Update 1.0.9 create the salt every time as the salt might be the problem (?) byte[] salt = CreateSalt(); // get the byte array byte[] passwordBits = HashPassword(password, salt); // create the hashInfo PasswordHashInfo hashInfo = new PasswordHashInfo(passwordBits, salt); // get the hashInfo string partI = hashInfo.ToString(); // set the return value part1 = EncryptString(partI, keyCode); } catch (Exception error) { // for debugging only for now, I may return a response one day DebugHelper.WriteDebugError("HashPart1", "CryptographyHelper", error); // explicit set to null part1 = ""; } // return value return(part1); }
private PasswordHashInfo PasswordInfo(string userId, string password) { string guidSalt = GetGUIDSalt(); string rngSalt = GetRNGSalt(); var passwordInfo = new PasswordHashInfo() { GUIDSalt = guidSalt, RNGSalt = rngSalt, PasswordHash = GetPasswordHash(userId, password, guidSalt, rngSalt) }; return(passwordInfo); }