예제 #1
0
        public static bool Sign_SHA256(string Input, ref string Output)
        {
            bool bResult = false;

            try
            {
                byte[]        SHA256Data = Encoding.UTF8.GetBytes(Input); // Encoding.GetEncoding("GBK").GetBytes(Input); //Encoding.Default.GetBytes(Input); //
                SHA256Managed Sha256     = new SHA256Managed();
                byte[]        Result     = Sha256.ComputeHash(SHA256Data);
                //Output= Convert.ToBase64String(Result);  //返回长度为44字节的字符串
                Output  = MyTools.ByteToString(Result, 0, Result.Length);
                bResult = true;
            }
            catch (Exception ex)
            {
                Output = "计算SHA256出错(ex=" + ex.ToString() + ")";
            }
            return(bResult);
        }
예제 #2
0
파일: CIcRdr.cs 프로젝트: wl2019/EB_for_YTB
        public bool ReadCardInf(out string szInf)
        {
            szInf = "";
            bool bResult = false;

            byte[] sData   = new byte[30];
            byte[] rData   = new byte[50];
            int    iRetLen = 0;

            sData[0] = 0xA5;
            sData[1] = 0x00;

            //Thread.Sleep(100);
            if (SendOrder(sData, 2, ref rData, ref iRetLen))
            {
                szInf = MyTools.ByteToString(rData, 2, iRetLen);
                if (rData[0] == 0 && rData[1] == 0 && iRetLen == 40)
                {
                    bResult = true;
                }
            }
            return(bResult);
        }