hu.netmind.util
Class FastCrc

java.lang.Object
  extended by hu.netmind.util.FastCrc

public class FastCrc
extends java.lang.Object

This class implements the fast crc algorithm (that is, it takes whole bytes at once).


Constructor Summary
FastCrc(int generator)
          Construct, and initialize the fast crc algorithm with the given generator polynomial.
 
Method Summary
 int crc(byte[] b)
          Generate crc code.
 int crc(byte[] b, int offset, int length)
          Generate crc code for given byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastCrc

public FastCrc(int generator)
Construct, and initialize the fast crc algorithm with the given generator polynomial.

Parameters:
generator - The generator polynomial.
Method Detail

crc

public int crc(byte[] b,
               int offset,
               int length)
Generate crc code for given byte array.

Parameters:
b - The byte array.
offset - The offset to start from.
length - The length of data.

crc

public int crc(byte[] b)
Generate crc code. Same as crc(b,0,b.length).

Parameters:
b - The byte data.