au.net.aba.crypto.provider
Class CRC16
java.lang.Object
|
+--java.security.MessageDigestSpi
|
+--java.security.MessageDigest
|
+--au.net.aba.crypto.provider.CRC16
- public class CRC16
- extends java.security.MessageDigest
A class that implements the CCITT CRC-16 checksumming algorithm, for the
reflected polynomial 0x8408. Note: if you want to do a zero value check
on some data and it's associated CRC, the CRC should be added after the
data, least significant byte first.
Field Summary |
static java.lang.String |
ident
|
Constructor Summary |
CRC16()
This constructor is used to begin a new CRC-16 operation |
Method Summary |
protected byte[] |
engineDigest()
return the CRC. |
protected void |
engineReset()
reset the CRC back to zero. |
protected void |
engineUpdate(byte b)
update the CRC with a single byte. |
protected void |
engineUpdate(byte[] bytes,
int offset,
int length)
update the CRC with an array of bytes. |
Methods inherited from class java.security.MessageDigest |
clone,
digest,
digest,
digest,
getAlgorithm,
getDigestLength,
getInstance,
getInstance,
getProvider,
isEqual,
reset,
toString,
update,
update,
update |
Methods inherited from class java.security.MessageDigestSpi |
engineDigest,
engineGetDigestLength |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
ident
public static final java.lang.String ident
CRC16
public CRC16()
- This constructor is used to begin a new CRC-16 operation
engineReset
protected void engineReset()
- reset the CRC back to zero.
- Overrides:
- engineReset in class java.security.MessageDigestSpi
engineUpdate
protected void engineUpdate(byte b)
- update the CRC with a single byte.
- Parameters:
b
- the byte of input.- Overrides:
- engineUpdate in class java.security.MessageDigestSpi
engineUpdate
protected void engineUpdate(byte[] bytes,
int offset,
int length)
- update the CRC with an array of bytes.
- Parameters:
bytes
- the input array.offset
- the offset to start getting bytes from.length
- the number of bytes to be processed.- Overrides:
- engineUpdate in class java.security.MessageDigestSpi
engineDigest
protected byte[] engineDigest()
- return the CRC. Note this resets it.
- Returns:
- the crc16 as a byte array.
- Overrides:
- engineDigest in class java.security.MessageDigestSpi