Class DigestBuilder
java.lang.Object
com.inductiveautomation.ignition.common.util.DigestBuilder
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
build()
Compute and return the digest.Compute and return the digest as a lower-case hex-encoded String.static DigestBuilder
static DigestBuilder
md5()
reset()
Manually reset the underlyingMessageDigest
.static DigestBuilder
sha1()
static DigestBuilder
sha256()
update
(boolean input) Update the digest input withinput
.update
(byte input) Update the digest input withinput
.update
(byte[] input) Update the digest input with the bytes from the big-endian representation of each element ofinput
.update
(double input) Update the digest input with the bytes from the big-endian representation ofinput
's raw long bits.update
(double[] input) Update the digest input with the bytes from the big-endian representation of each element ofinput
.update
(float input) Update the digest input with the bytes from the big-endian representation ofinput
's raw int bits.update
(float[] input) Update the digest input with the bytes from the big-endian representation of each element ofinput
.update
(int input) Update the digest input with the bytes from the big-endian representation ofinput
.update
(int[] input) Update the digest input with the bytes from the big-endian representation of each element ofinput
.update
(long input) Update the digest input with the bytes from the big-endian representation ofinput
.update
(long[] input) Update the digest input with the bytes from the big-endian representation of each element ofinput
.update
(short input) Update the digest input with the bytes from the big-endian representation ofinput
.update
(short[] input) Update the digest input with the bytes from the big-endian representation of each element ofinput
.Update the digest input with bytes frominput
inStandardCharsets.UTF_8
encoding.Update the digest input with bytes frominput
incharset
encoding.
-
Method Details
-
md5
- Returns:
- a
DigestBuilder
that uses the MD5 algorithm.
-
sha1
- Returns:
- a
DigestBuilder
that uses the SHA-1 algorithm.
-
sha256
- Returns:
- a
DigestBuilder
that uses the SHA-256 algorithm.
-
custom
- Parameters:
algorithm
- the message digest algorithm.- Returns:
- a
DigestBuilder
that usesalgorithm
. - Throws:
NoSuchAlgorithmException
- if no message digest foralgorithm
is available.
-
update
Update the digest input with bytes frominput
inStandardCharsets.UTF_8
encoding.- Parameters:
input
- the input String.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with bytes frominput
incharset
encoding.- Parameters:
input
- the input String.charset
- the encodingCharset
.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input withinput
.If
true
, a byte equal to 1, otherwise 0.- Parameters:
input
- the input boolean.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input withinput
.- Parameters:
input
- the inpute byte.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation ofinput
.- Parameters:
input
- the input short.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation ofinput
.- Parameters:
input
- the input int.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation ofinput
.- Parameters:
input
- the input long.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation ofinput
's raw int bits.- Parameters:
input
- the input float.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation ofinput
's raw long bits.- Parameters:
input
- the input double.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation of each element ofinput
.- Parameters:
input
- the input array.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation of each element ofinput
.- Parameters:
input
- the input array.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation of each element ofinput
.- Parameters:
input
- the input array.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation of each element ofinput
.- Parameters:
input
- the input array.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation of each element ofinput
.- Parameters:
input
- the input array.- Returns:
- this
DigestBuilder
.
-
update
Update the digest input with the bytes from the big-endian representation of each element ofinput
.- Parameters:
input
- the input array.- Returns:
- this
DigestBuilder
.
-
reset
Manually reset the underlyingMessageDigest
.This is done automatically after a call to
build()
orbuildHexString()
.- Returns:
- this
DigestBuilder
.
-
build
public byte[] build()Compute and return the digest.The underlying
MessageDigest
is reset and this builder can be re-used.- Returns:
- the computed digest.
-
buildHexString
Compute and return the digest as a lower-case hex-encoded String.The underlying
MessageDigest
is reset and this builder can be re-used.- Returns:
- the computed digest as a lower-case hex-encoded String.
-