source: josm/trunk/src/org/tukaani/xz/lz/CRC32Hash.java@ 13867

Last change on this file since 13867 was 13350, checked in by stoecker, 7 years ago

see #15816 - add XZ support

File size: 757 bytes
Line 
1/*
2 * CRC32Hash
3 *
4 * Authors: Lasse Collin <lasse.collin@tukaani.org>
5 * Igor Pavlov <http://7-zip.org/>
6 *
7 * This file has been put into the public domain.
8 * You can do whatever you want with this file.
9 */
10
11package org.tukaani.xz.lz;
12
13/**
14 * Provides a CRC32 table using the polynomial from IEEE 802.3.
15 */
16class CRC32Hash {
17 private static final int CRC32_POLY = 0xEDB88320;
18
19 static final int[] crcTable = new int[256];
20
21 static {
22 for (int i = 0; i < 256; ++i) {
23 int r = i;
24
25 for (int j = 0; j < 8; ++j) {
26 if ((r & 1) != 0)
27 r = (r >>> 1) ^ CRC32_POLY;
28 else
29 r >>>= 1;
30 }
31
32 crcTable[i] = r;
33 }
34 }
35}
Note: See TracBrowser for help on using the repository browser.