final public class CRC32Util {
/**
* Generate checksum of string.
* @param text
* @return CRC32
*/
public static int getCRC32(String text)
{
CRC32 crc = new CRC32();
crc.update(text.getBytes());
return (int) crc.getValue();
}
/**
* Generate checksum of bytes.
* @param text
* @return
*/
public static int getByteCRC32(byte[] text)
{
CRC32 crc = new CRC32();
crc.update(text);
return (int) crc.getValue();
}
}
No comments:
Post a Comment