public string GeneratePasswordHashUsingSaltOptimized() { var pbkdf2 = new Rfc2898DeriveBytes(passwordText, salt, iterations); Span <byte> byteArr = stackalloc byte[36]; byteArr.AddRange(salt, 0, 16); byteArr.AddRange(pbkdf2.GetBytes(20), 16, 36); var passwordHash = Convert.ToBase64String(byteArr); return(passwordHash); }