Package org.apache.sshd.common.digest
Class BaseDigest
- java.lang.Object
-
- org.apache.sshd.common.digest.BaseDigest
-
- All Implemented Interfaces:
java.lang.Comparable<Digest>,AlgorithmNameProvider,Digest,DigestInformation
public class BaseDigest extends java.lang.Object implements Digest
Base class for Digest algorithms based on the JCE provider.
-
-
Constructor Summary
Constructors Constructor Description BaseDigest(java.lang.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(java.lang.Object obj)java.lang.StringgetAlgorithm()intgetBlockSize()protected java.security.MessageDigestgetMessageDigest()inthashCode()voidinit()java.lang.StringtoString()voidupdate(byte[] data)voidupdate(byte[] data, int start, int len)
-
-
-
Constructor Detail
-
BaseDigest
public BaseDigest(java.lang.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 java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfaceAlgorithmNameProvider
-
getBlockSize
public int getBlockSize()
- Specified by:
getBlockSizein interfaceDigestInformation- Returns:
- The number of bytes in the digest's output
-
init
public void init() throws java.lang.Exception
-
update
public void update(byte[] data) throws java.lang.Exception
-
update
public void update(byte[] data, int start, int len) throws java.lang.Exception
-
getMessageDigest
protected java.security.MessageDigest getMessageDigest()
- Returns:
- The current
MessageDigest- may benullifinit()not called
-
digest
public byte[] digest() throws java.lang.Exception
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(Digest that)
- Specified by:
compareToin interfacejava.lang.Comparable<Digest>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-