Exemple #1
0
        public static string GenerateToken(string appkey, string uniqueId)
        {
            var guid = Guid.NewGuid();
            var code = string.Format("{0}{1}{2}{3}", guid.ToString(), appkey, uniqueId, DateTime.UtcNow.Ticks);

            return(SHA.ComputeSHA1Hash(code));
        }
Exemple #2
0
        /// <summary>
        /// Generate a string length less than 128
        /// </summary>
        /// <param name="appName"></param>
        /// <returns></returns>
        public static string GenerateAppkey(string appName)
        {
            var guid = Guid.NewGuid();
            var code = string.Format("{0}_{1}_{2}", guid.ToString(), appName, DateTime.UtcNow.Ticks);

            return(SHA.ComputeSHA1Hash(code));
        }
Exemple #3
0
 /// <summary>
 /// Hash password into DB format
 /// </summary>
 /// <param name="password">string password</param>
 /// <param name="sault">string salt</param>
 /// <returns>Hashed password string</returns>
 public string HashPassword(string password, string salt)
 {
     return(SHA.ComputeSHA1Hash(String.Concat(salt, SHA.ComputeSHA1Hash(
                                                  String.Concat(salt, SHA.ComputeSHA1Hash(password))
                                                  ))));
 }