Package org.apache.sshd.common.digest
Class BaseDigest
- java.lang.Object
-
- org.apache.sshd.common.digest.BaseDigest
-
- All Implemented Interfaces:
Comparable<Digest>
,AlgorithmNameProvider
,Digest
,DigestInformation
public class BaseDigest extends Object implements Digest
Base class for Digest algorithms based on the JCE provider.- Author:
- Apache MINA SSHD Project
-
-
Constructor Summary
Constructors Constructor Description BaseDigest(String algorithm, int bsize)
Create a new digest using the given algorithm and block size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Digest that)
byte[]
digest()
boolean
equals(Object obj)
String
getAlgorithm()
int
getBlockSize()
protected MessageDigest
getMessageDigest()
int
hashCode()
void
init()
String
toString()
void
update(byte[] data)
void
update(byte[] data, int start, int len)
-
-
-
Constructor Detail
-
BaseDigest
public BaseDigest(String algorithm, int bsize)
Create a new digest using the given algorithm and block size. The initialization and creation of the underlyingMessageDigest
object will be done in theinit()
method.- Parameters:
algorithm
- the JCE algorithm to use for this digestbsize
- the block size of this digest
-
-
Method Detail
-
getAlgorithm
public final String getAlgorithm()
- Specified by:
getAlgorithm
in interfaceAlgorithmNameProvider
-
getBlockSize
public int getBlockSize()
- Specified by:
getBlockSize
in interfaceDigestInformation
- Returns:
- The number of bytes in the digest's output
-
update
public void update(byte[] data) throws Exception
-
update
public void update(byte[] data, int start, int len) throws Exception
-
getMessageDigest
protected MessageDigest getMessageDigest()
- Returns:
- The current
MessageDigest
- may benull
ifinit()
not called
-
digest
public byte[] digest() throws Exception
-
compareTo
public int compareTo(Digest that)
- Specified by:
compareTo
in interfaceComparable<Digest>
-
-