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 intcompareTo(Digest that)byte[]digest()booleanequals(Object obj)StringgetAlgorithm()intgetBlockSize()protected MessageDigestgetMessageDigest()inthashCode()voidinit()StringtoString()voidupdate(byte[] data)voidupdate(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 underlyingMessageDigestobject 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:
getAlgorithmin interfaceAlgorithmNameProvider
-
getBlockSize
public int getBlockSize()
- Specified by:
getBlockSizein 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 benullifinit()not called
-
digest
public byte[] digest() throws Exception
-
compareTo
public int compareTo(Digest that)
- Specified by:
compareToin interfaceComparable<Digest>
-
-