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

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

            byte[] hashBytes = hash.ComputeHash(stream);
            return(ToString(hashBytes));
        }