public class BaseDigest extends java.lang.Object implements Digest
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
algorithm |
private int |
bsize |
private int |
h |
private java.security.MessageDigest |
md |
private java.lang.String |
s |
Constructor and Description |
---|
BaseDigest(java.lang.String algorithm,
int bsize)
Create a new digest using the given algorithm and block size.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Digest that) |
byte[] |
digest() |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAlgorithm() |
int |
getBlockSize() |
protected java.security.MessageDigest |
getMessageDigest() |
int |
hashCode() |
void |
init() |
java.lang.String |
toString() |
void |
update(byte[] data) |
void |
update(byte[] data,
int start,
int len) |
private final java.lang.String algorithm
private final int bsize
private int h
private java.lang.String s
private java.security.MessageDigest md
public BaseDigest(java.lang.String algorithm, int bsize)
MessageDigest
object will be done in the init()
method.algorithm
- the JCE algorithm to use for this digestbsize
- the block size of this digestpublic final java.lang.String getAlgorithm()
getAlgorithm
in interface DigestInformation
public int getBlockSize()
getBlockSize
in interface DigestInformation
public void init() throws java.lang.Exception
public void update(byte[] data) throws java.lang.Exception
public void update(byte[] data, int start, int len) throws java.lang.Exception
protected java.security.MessageDigest getMessageDigest()
MessageDigest
- may be null
if init()
not calledpublic byte[] digest() throws java.lang.Exception
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Digest that)
compareTo
in interface java.lang.Comparable<Digest>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object