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

            byte[] hashBytes = hash.ComputeHash(buffer);
            return(ToString(hashBytes));
        }
예제 #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));
        }
예제 #3
0
        /// <summary>
        /// 获取数据流的CRC32
        /// </summary>
        public static string StreamCRC32(Stream stream)
        {
            CRC32Algorithm hash = new CRC32Algorithm();

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