public class Checksum extends Object
Constructor and Description |
---|
Checksum()
Initializes a new Checksum generator using the default SHA-1 algorithm.
|
Checksum(String algorithm)
Initializes a new Checksum generator using the specified algorithm.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
hash(byte[] bytes)
Produce a checksum/hashsum of a given block of data.
|
String |
hashToHexString(byte[] hash)
Convert a hash to a hexidecimal String.
|
public Checksum() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public Checksum(String algorithm) throws NoSuchAlgorithmException
algorithm
- algorithm to use to generate checksums.NoSuchAlgorithmException
public byte[] hash(byte[] bytes)
bytes
- data bytes to checksum.public String hashToHexString(byte[] hash)
hash
- the hash value to convertCopyright © 2015. All rights reserved.