Example #1
0
        /// <summary>
        /// Computes CRC32 for byte array
        /// </summary>
        public static uint ForBytes(byte[] buff)
        {
            var crc = new CRC32();

            crc.Add(buff);
            return(crc.m_CRC);
        }
Example #2
0
        /// <summary>
        /// Computes CRC32 for binary string representation (in-memory)
        /// </summary>
        public static uint ForString(string text)
        {
            if (text.IsNullOrWhiteSpace())
            {
                return(0);
            }

            var crc = new CRC32();

            for (var i = 0; i < text.Length; i++)
            {
                crc.Add(text[i]);
            }

            return(crc.m_CRC);
        }
Example #3
0
  /// <summary>
 /// Computes CRC32 for byte array
 /// </summary>
 public static uint ForBytes(byte[] buff)
 {
   var crc = new CRC32();
   crc.Add( buff );
   return crc.m_CRC;
 } 
Example #4
0
      /// <summary>
      /// Computes CRC32 for binary string representation (in-memory)
      /// </summary>
      public static uint ForString(string text)
      {
        if (text.IsNullOrWhiteSpace()) return 0;

        var crc = new CRC32();
        for(var i=0; i<text.Length; i++)
          crc.Add( text[i] );

        return crc.m_CRC;
      }