Ejemplo n.º 1
0
        public static bool InHexFormat(string hexString)
        {
            bool flag = true;

            foreach (char c in hexString)
            {
                if (!HexEncoding.IsHexDigit(c))
                {
                    flag = false;
                    break;
                }
            }
            return(flag);
        }
Ejemplo n.º 2
0
 public string GetTextDescript(string text)
 {
     try
     {
         byte[] bytes = HexEncoding.GetBytes(text.Substring(0, 16));
         return(Encoding.UTF8.GetString(new Decryptor(EncryptionAlgorithm.TripleDes)
         {
             IV = bytes
         }.Decrypt(HexEncoding.GetBytes(text.Substring(16, text.Length - 16)), this.key)));
     }
     catch (SystemException ex)
     {
         ex.ToString();
         this.Error = true;
         return("");
     }
 }
Ejemplo n.º 3
0
        public static int GetByteCount(string hexString)
        {
            int num = 0;

            for (int index = 0; index < hexString.Length; ++index)
            {
                if (HexEncoding.IsHexDigit(hexString[index]))
                {
                    ++num;
                }
            }
            if (num % 2 != 0)
            {
                --num;
            }
            return(num / 2);
        }