Package org.wildfly.security.digest
Class TruncatedMessageDigest
- java.lang.Object
-
- java.security.MessageDigestSpi
-
- java.security.MessageDigest
-
- org.wildfly.security.digest.TruncatedMessageDigest
-
public final class TruncatedMessageDigest extends MessageDigest
A message digest that truncates another message digest.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description private int
bytes
private MessageDigest
delegate
-
Constructor Summary
Constructors Constructor Description TruncatedMessageDigest(MessageDigest delegate, int bytes)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
byte[]
digest()
byte[]
digest(byte[] input)
int
digest(byte[] buf, int offset, int len)
protected byte[]
engineDigest()
protected void
engineReset()
protected void
engineUpdate(byte input)
protected void
engineUpdate(byte[] input, int offset, int len)
void
reset()
void
update(byte input)
void
update(byte[] input)
void
update(byte[] input, int offset, int len)
-
Methods inherited from class java.security.MessageDigest
getAlgorithm, getDigestLength, getInstance, getInstance, getInstance, getProvider, isEqual, toString, update
-
Methods inherited from class java.security.MessageDigestSpi
engineDigest, engineGetDigestLength, engineUpdate
-
-
-
-
Field Detail
-
delegate
private final MessageDigest delegate
-
bytes
private final int bytes
-
-
Constructor Detail
-
TruncatedMessageDigest
public TruncatedMessageDigest(MessageDigest delegate, int bytes)
Construct a new instance.- Parameters:
delegate
- the delegate message digestbytes
- the truncation size
-
-
Method Detail
-
update
public void update(byte input)
- Overrides:
update
in classMessageDigest
-
update
public void update(byte[] input, int offset, int len)
- Overrides:
update
in classMessageDigest
-
update
public void update(byte[] input)
- Overrides:
update
in classMessageDigest
-
digest
public byte[] digest()
- Overrides:
digest
in classMessageDigest
-
digest
public int digest(byte[] buf, int offset, int len) throws DigestException
- Overrides:
digest
in classMessageDigest
- Throws:
DigestException
-
digest
public byte[] digest(byte[] input)
- Overrides:
digest
in classMessageDigest
-
reset
public void reset()
- Overrides:
reset
in classMessageDigest
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classMessageDigest
- Throws:
CloneNotSupportedException
-
engineUpdate
protected void engineUpdate(byte input)
- Specified by:
engineUpdate
in classMessageDigestSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len)
- Specified by:
engineUpdate
in classMessageDigestSpi
-
engineDigest
protected byte[] engineDigest()
- Specified by:
engineDigest
in classMessageDigestSpi
-
engineReset
protected void engineReset()
- Specified by:
engineReset
in classMessageDigestSpi
-
-