jonelo.jacksum.algorithm
Class CrcGeneric
AbstractChecksum
jonelo.jacksum.algorithm.CrcGeneric
public class CrcGeneric
extends AbstractChecksum
Jacksum version 1.7.0 - checksum utility in Java
Copyright (C) 2001-2006 Dipl.-Inf. (FH) Johann Nepomuk Loefflmann,
All Rights Reserved, http://www.jonelo.de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
E-mail: jonelo@jonelo.de
CrcGeneric(String props) - Constructor with a String parameter
|
CrcGeneric(int width, long poly, long initialValue, boolean refIn, boolean refOut, long xorOut) - Constructor with all parameters as defined in the
Rocksoft^tm Model CRC Algorithm
|
byte[] | getByteArray() - Returns the result of the computation as byte array
|
long | getInitialValue() - Get the initial register value
|
String | getName() - Get the name of the algorithm
|
long | getPoly() - Get the algorithm's polynomial
|
boolean | getRefIn() - Should input bytes be reflected?
|
boolean | getRefOut() - Get whether the output CRC should be reflected
|
String | getString() - The toString() method is derived from the AbstractChecksum
|
long | getValue() - Returns the value of the checksum
|
int | getWidth() - Get the width in bits
|
long | getXorOut() - Get the XOR parameter
|
void | reset() - Resets the checksum object to its initial values for further use
|
void | setInitialValue(long initialValue) - Set the initial register value
|
void | setPoly(long poly) - Set the algorithm's polynomial
|
void | setRefIn(boolean refIn) - Reflect input bytes?
|
void | setRefOut(boolean refOut) - Set whether the output CRC should be reflected
|
void | setWidth(int width) - Set the width in bits
|
void | setXorOut(long xorOut) - Set the XOR parameter
|
void | update(byte b) - Updates the checksum with the specified byte
|
void | update(int b) - Updates the checksum with the specified byte
|
CrcGeneric
public CrcGeneric(String props)
throws NoSuchAlgorithmException
Constructor with a String parameter
props
- All parameters as defined in the Rocksoft^tm Model CRC Algorithm separated by a comma
Example: crc:32,04C11DB7,FFFFFFFF,true,true,FFFFFFFF
CrcGeneric
public CrcGeneric(int width,
long poly,
long initialValue,
boolean refIn,
boolean refOut,
long xorOut)
throws NoSuchAlgorithmException
Constructor with all parameters as defined in the
Rocksoft^tm Model CRC Algorithm
width
- the width of the value in bitspoly
- The algorithm's polynomial (without the highest bit)initialValue
- the initial register valuerefIn
- Reflect input bytes?refOut
- Reflect output CRC?xorOut
- XOR this to output CRC
getByteArray
public byte[] getByteArray()
Returns the result of the computation as byte array
- the result of the computation as byte array
getInitialValue
public long getInitialValue()
Get the initial register value
- the initial register value
getName
public String getName()
Get the name of the algorithm
- the name of the algorithm as String
getPoly
public long getPoly()
Get the algorithm's polynomial
- the algorithm's polynomial
getRefIn
public boolean getRefIn()
Should input bytes be reflected?
- should input bytes be reflected?
getRefOut
public boolean getRefOut()
Get whether the output CRC should be reflected
- should the output CRC be reflected?
getString
public String getString()
The toString() method is derived from the AbstractChecksum
- a String which is understood by the constructor
getValue
public long getValue()
Returns the value of the checksum
- the value of the checksum
getWidth
public int getWidth()
Get the width in bits
getXorOut
public long getXorOut()
Get the XOR parameter
reset
public void reset()
Resets the checksum object to its initial values for further use
setInitialValue
public void setInitialValue(long initialValue)
Set the initial register value
initialValue
- the initial register value
setPoly
public void setPoly(long poly)
Set the algorithm's polynomial
poly
- the algorithm's polynomial
setRefIn
public void setRefIn(boolean refIn)
Reflect input bytes?
refIn
- reflect input bytes?
setRefOut
public void setRefOut(boolean refOut)
Set whether the output CRC should be reflected
refOut
- should the output CRC be reflected?
setWidth
public void setWidth(int width)
Set the width in bits
width
- the width in bits
setXorOut
public void setXorOut(long xorOut)
Set the XOR parameter
xorOut
- the XOR parameter
update
public void update(byte b)
Updates the checksum with the specified byte
update
public void update(int b)
Updates the checksum with the specified byte