public Write ( byte p, int offset, int count ) : void | ||
p | byte | |
offset | int | |
count | int | |
return | void |
/// <summary> /// 计算字节数据的crc32值 /// </summary> /// <param name="data">二进制数据</param> /// <param name="length">长度</param> /// <returns>crc32值</returns> public static UInt32 CheckSumBytes(byte[] data) { CRC32 crc = new CRC32(); crc.Write(data, 0, data.Length); return(crc.Sum32()); }
public static UInt32 CheckSumSlice(byte[] data, int offset, int count) { CRC32 crc = new CRC32(); crc.Write(data, offset, count); return(crc.Sum32()); }
public static UInt32 CheckSumFile(string fileName) { CRC32 crc = new CRC32 (); int bufferLen = 32 * 1024; using (FileStream fs = File.OpenRead(fileName)) { byte[] buffer = new byte[bufferLen]; while (true) { int n = fs.Read (buffer, 0, bufferLen); if (n == 0) break; crc.Write (buffer, 0, n); } } return crc.Sum32 (); }
/// <summary> /// 计算沙盒文件的crc32值 /// </summary> /// <param name="filePath">沙盒文件全路径</param> /// <returns>crc32值</returns> public static UInt32 CheckSumFile(string filePath) { CRC32 crc = new CRC32(); int bufferLen = 32 * 1024; using (FileStream fs = IsolatedStorageFile.GetUserStoreForApplication().OpenFile(filePath, FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[bufferLen]; while (true) { int n = fs.Read(buffer, 0, bufferLen); if (n == 0) break; crc.Write(buffer, 0, n); } } return crc.Sum32(); }
public static UInt32 CheckSumFile(string fileName) { CRC32 crc = new CRC32(); int bufferLen = 32 * 1024; using (FileStream fs = File.OpenRead(fileName)) { byte[] buffer = new byte[bufferLen]; while (true) { int n = fs.Read(buffer, 0, bufferLen); if (n == 0) { break; } crc.Write(buffer, 0, n); } } return(crc.Sum32()); }
/// <summary> /// 计算沙盒文件的crc32值 /// </summary> /// <param name="filePath">沙盒文件全路径</param> /// <returns>crc32值</returns> public static UInt32 CheckSumFile(string filePath) { CRC32 crc = new CRC32(); int bufferLen = 32 * 1024; using (FileStream fs = IsolatedStorageFile.GetUserStoreForApplication().OpenFile(filePath, FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[bufferLen]; while (true) { int n = fs.Read(buffer, 0, bufferLen); if (n == 0) { break; } crc.Write(buffer, 0, n); } } return(crc.Sum32()); }
/// <summary> /// 计算沙盒文件的crc32值 /// </summary> /// <param name="filePath">沙盒文件全路径</param> /// <returns>crc32值</returns> public static uint checkSumFile(string filePath) { CRC32 crc = new CRC32(); int bufferLen = 32 * 1024; using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[bufferLen]; while (true) { int n = fs.Read(buffer, 0, bufferLen); if (n == 0) { break; } crc.Write(buffer, 0, n); } } return(crc.Sum()); }
public static UInt32 CheckSumSlice(byte[] data, int offset, int count) { CRC32 crc = new CRC32(); crc.Write(data, offset, count); return crc.Sum32(); }
/// <summary> /// 计算字节数据的crc32值 /// </summary> /// <param name="data">二进制数据</param> /// <param name="length">长度</param> /// <returns>crc32值</returns> public static UInt32 CheckSumBytes(byte[] data) { CRC32 crc = new CRC32(); crc.Write(data, 0, data.Length); return crc.Sum32(); }