| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.tukaani.xz.check; |
| 6 |
|
| 7 |
import org.tukaani.xz.common.ByteArrayView; |
| 8 |
|
| 9 |
public class CRC32 extends Check { |
| 10 |
private final java.util.zip.CRC32 state = new java.util.zip.CRC32(); |
| 11 |
|
| 12 |
public CRC32() { |
| 13 |
size = 4; |
| 14 |
name = "CRC32"; |
| 15 |
} |
| 16 |
|
| 17 |
@Override |
| 18 |
public void update(byte[] buf, int off, int len) { |
| 19 |
state.update(buf, off, len); |
| 20 |
} |
| 21 |
|
| 22 |
@Override |
| 23 |
public byte[] finish() { |
| 24 |
byte[] buf = new byte[4]; |
| 25 |
ByteArrayView.setIntLE(buf, 0, (int)state.getValue()); |
| 26 |
state.reset(); |
| 27 |
return buf; |
| 28 |
} |
| 29 |
} |