org.tukaani.xz.lz.CRC32Hash Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-compress Show documentation
Show all versions of commons-compress Show documentation
Apache Commons Compress software defines an API for working with
compression and archive formats. These include: bzip2, gzip, pack200,
lzma, xz, Snappy, traditional Unix Compress, DEFLATE, DEFLATE64, LZ4,
Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.
/*
* CRC32Hash
*
* Authors: Lasse Collin
* Igor Pavlov
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
*/
package org.tukaani.xz.lz;
/**
* Provides a CRC32 table using the polynomial from IEEE 802.3.
*/
class CRC32Hash {
private static final int CRC32_POLY = 0xEDB88320;
static final int[] crcTable = new int[256];
static {
for (int i = 0; i < 256; ++i) {
int r = i;
for (int j = 0; j < 8; ++j) {
if ((r & 1) != 0)
r = (r >>> 1) ^ CRC32_POLY;
else
r >>>= 1;
}
crcTable[i] = r;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy