Пример #1
0
        /// <summary>
        /// Set the checksum.
        /// </summary>
        /// <param name="data">Checksum as string.</param>
        public void SetSum(string data)
        {
            data.Trim();

            // In string every byte has two chars
            if (data.Length == CheckSumDataSHA1.Length * 2)
            {
                _checkSum = new CheckSumDataSHA1(data);
            }
            else if (data.Length == CheckSumDataMD5.Length * 2)
            {
                _checkSum = new CheckSumDataMD5(data);
            }
            else if (data.Length == CheckSumDataCRC32.Length * 2)
            {
                _checkSum = new CheckSumDataCRC32(data);
            }
            else if (data.Length == CheckSumDataCRC64.Length * 2)
            {
                _checkSum = new CheckSumDataCRC64(data);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Пример #2
0
 /// <summary>
 /// Set the checksum.
 /// </summary>
 /// <param name="data">Checksum as byte table.</param>
 public void SetSum(byte[] data)
 {
     if (data.Length == CheckSumDataSHA1.Length)
     {
         _checkSum = new CheckSumDataSHA1(data);
     }
     else if (data.Length == CheckSumDataMD5.Length)
     {
         _checkSum = new CheckSumDataMD5(data);
     }
     else if (data.Length == CheckSumDataCRC32.Length)
     {
         _checkSum = new CheckSumDataCRC32(data);
     }
     else if (data.Length == CheckSumDataCRC64.Length)
     {
         _checkSum = new CheckSumDataCRC64(data);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Пример #3
0
        /// <summary>
        /// Set the checksum.
        /// </summary>
        /// <param name="data">Checksum as string.</param>
        public void SetSum(string data)
        {
            data.Trim();

            // In string every byte has two chars
            if (data.Length == CheckSumDataSHA1.Length * 2)
                _checkSum = new CheckSumDataSHA1(data);
            else if (data.Length == CheckSumDataMD5.Length * 2)
                _checkSum = new CheckSumDataMD5(data);
            else if (data.Length == CheckSumDataCRC32.Length * 2)
                _checkSum = new CheckSumDataCRC32(data);
            else
                throw new NotImplementedException();
        }
Пример #4
0
 /// <summary>
 /// Set the checksum.
 /// </summary>
 /// <param name="data">Checksum as byte table.</param>
 public void SetSum(byte[] data)
 {
     if (data.Length == CheckSumDataSHA1.Length)
         _checkSum = new CheckSumDataSHA1(data);
     else if (data.Length == CheckSumDataMD5.Length)
         _checkSum = new CheckSumDataMD5(data);
     else if (data.Length == CheckSumDataCRC32.Length)
         _checkSum = new CheckSumDataCRC32(data);
     else
         throw new NotImplementedException();
 }