Example #1
0
        /// <summary>
        /// 获取字节数组的CRC32
        /// </summary>
        public static string BytesCRC32(byte[] buffer)
        {
            CRC32Algorithm hash = new CRC32Algorithm();

            byte[] hashBytes = hash.ComputeHash(buffer);
            return(ToString(hashBytes));
        }
Example #2
0
        /// <summary>
        /// 获取数据流的CRC32
        /// </summary>
        public static uint StreamCRC32(Stream stream)
        {
            CRC32Algorithm hash = new CRC32Algorithm();

            byte[] hashBytes = hash.ComputeHash(stream);
            return(BitConverter.ToUInt32(hashBytes, 0));
        }
Example #3
0
        /// <summary>
        /// 获取数据流的CRC32
        /// </summary>
        public static string StreamCRC32(Stream stream)
        {
            CRC32Algorithm hash = new CRC32Algorithm();

            byte[] hashBytes = hash.ComputeHash(stream);
            return(ToString(hashBytes));
        }
Example #4
0
 /// <summary>
 /// 获取字节数组的CRC32
 /// </summary>
 public static uint BytesCRC32(byte[] buffer)
 {
     return(CRC32Algorithm.Compute(buffer));
 }