Class HashCalculator
java.lang.Object
com.pnfsoftware.jeb.util.encoding.HashCalculator
Memory and CPU efficient way to compute message digests.
This class supersedes Hash
.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final Long
adler32
(InputStream in) Utility method.boolean
compute()
Compute the requested digests and stream size.static final Long
crc32
(InputStream in) Utility method.long
long
getCrc32()
byte[]
getMd5()
byte[]
getSha1()
byte[]
long
getSize()
static final byte[]
md5
(InputStream in) Utility method.static final byte[]
sha1
(InputStream in) Utility method.static final byte[]
sha256
(InputStream in) Utility method.
-
Field Details
-
CRC32
public static final int CRC32- See Also:
-
ADLER32
public static final int ADLER32- See Also:
-
MD5
public static final int MD5- See Also:
-
SHA1
public static final int SHA1- See Also:
-
SHA256
public static final int SHA256- See Also:
-
-
Constructor Details
-
HashCalculator
-
-
Method Details
-
crc32
Utility method. -
adler32
Utility method. -
md5
Utility method. -
sha1
Utility method. -
sha256
Utility method. -
getSize
public long getSize() -
getCrc32
public long getCrc32() -
getAdler32
public long getAdler32() -
getMd5
public byte[] getMd5() -
getSha1
public byte[] getSha1() -
getSha256
public byte[] getSha256() -
compute
Compute the requested digests and stream size.- Returns:
- true on success, false if one of the requested digest algorithm is not available
- Throws:
IOException
- on stream IO error
-