Пример #1
0
 private frmCheckSum(string filePath)
 {
     InitializeComponent();
     _quickCrc         = new QuickCrc32(CRCProgressChanged, CRCProcessFinished);
     txtResult.Text    = "Press 'Start'";
     btnStartStop.Text = "Start";
     _filePath         = filePath;
 }
Пример #2
0
        public void ComputeToBase64Test()
        {
            //ref: http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
            //ref: http://www.zorc.breitbandkatze.de/crc.html

            var bytes = Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dog");

            Assert.IsTrue(QuickCrc32.ComputeToString(bytes) == "414FA339");
        }
Пример #3
0
        private void setCrc()
        {
            byte[] chunkInfo = new byte[data.Length + type.Length];
            for (int i = 0; i < chunkInfo.Length; i++)
            {
                if (i < type.Length)
                {
                    chunkInfo[i] = type[i]; //type "cLDc"
                }
                else
                {
                    chunkInfo[i] = data[i - type.Length];
                }
            }
            uint checksum = QuickCrc32.Compute(chunkInfo); //get the crc.

            byte[] crcBytes = BitConverter.GetBytes(checksum);
            crc = crcBytes;
            // foreach(byte b in crc)
            // Console.WriteLine("byteLength: " + b.ToString());
        }