Пример #1
0
        private string abbr(string word)
        {
            if (word.Length <= 2)
            {
                return(word);
            }
            stringBuilder sb = new stringBuilder();

            sb.Append(word[0]);
            sb.Append(word.Length - 2);
            sb.Append(word[word.Length - 1]);
            return(sb.Tostring());
        }
Пример #2
0
        protected string CalculateAccessKey(string accountId, string apiKey)
        {
            MD5 md5 = System.Security.Cryptography.MD5.Create();

            byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(accountId + apiKey);
            byte[] hashBytes  = md5.ComputeHash(inputBytes);

            // Convert the byte array to hexadecimal string
            stringBuilder sb = new stringBuilder();

            for (int i = 0; i < hashBytes.Length; i++)
            {
                sb.Append(hashBytes[i].Tostring("X2"));
            }
            return(sb.Tostring());
        }