Class AbstractMessageDigestSpi
- java.lang.Object
-
- java.security.MessageDigestSpi
-
- com.microej.crypto.internal.digest.AbstractMessageDigestSpi
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AbstractBufferedMessageDigestSpi
public abstract class AbstractMessageDigestSpi extends MessageDigestSpi implements Cloneable
Common base message digest implementation for the Sun provider. It implements all the JCA methods as suitable for a Java message digest implementation of an algorithm based on a compression function (as all commonly used algorithms are). The individual digest subclasses only need to implement the following methods: . abstract void implCompress(byte[] b, int ofs); . abstract void implDigest(byte[] out, int ofs); . abstract void implReset(); See the inline documentation for details. Implementation copied fromsun.security.provider.DigestBase.- Since:
- 1.5
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]engineDigest()Completes the hash computation by performing final operations such as padding.protected intengineDigest(byte[] out, int ofs, int len)Completes the hash computation by performing final operations such as padding.intengineGetDigestLength()Returns the digest length in bytes.protected voidengineReset()Resets the digest for further use.protected voidengineUpdate(byte b)Updates the digest using the specified byte.voidengineUpdate(byte[] b, int ofs, int len)Updates the digest using the specified array of bytes, starting at the specified offset.-
Methods inherited from class java.security.MessageDigestSpi
clone
-
-
-
-
Method Detail
-
engineGetDigestLength
public final int engineGetDigestLength()
Description copied from class:MessageDigestSpiReturns the digest length in bytes.This concrete method has been added to this previously-defined abstract class. (For backwards compatibility, it cannot be abstract.)
The default behavior is to return 0.
This method may be overridden by a provider to return the digest length.
- Overrides:
engineGetDigestLengthin classMessageDigestSpi- Returns:
- the digest length in bytes.
-
engineUpdate
protected final void engineUpdate(byte b)
Description copied from class:MessageDigestSpiUpdates the digest using the specified byte.- Specified by:
engineUpdatein classMessageDigestSpi- Parameters:
b- the byte to use for the update.
-
engineUpdate
public final void engineUpdate(byte[] b, int ofs, int len)Description copied from class:MessageDigestSpiUpdates the digest using the specified array of bytes, starting at the specified offset.- Specified by:
engineUpdatein classMessageDigestSpi- Parameters:
b- the array of bytes to use for the update.ofs- the offset to start from in the array of bytes.len- the number of bytes to use, starting atoffset.
-
engineReset
protected void engineReset()
Description copied from class:MessageDigestSpiResets the digest for further use.- Specified by:
engineResetin classMessageDigestSpi
-
engineDigest
public final byte[] engineDigest()
Description copied from class:MessageDigestSpiCompletes the hash computation by performing final operations such as padding. OnceengineDigesthas been called, the engine should be reset (seeengineReset). Resetting is the responsibility of the engine implementor.- Specified by:
engineDigestin classMessageDigestSpi- Returns:
- the array of bytes for the resulting hash value.
-
engineDigest
protected final int engineDigest(byte[] out, int ofs, int len) throws DigestExceptionDescription copied from class:MessageDigestSpiCompletes the hash computation by performing final operations such as padding. OnceengineDigesthas been called, the engine should be reset (seeengineReset). Resetting is the responsibility of the engine implementor. This method should be abstract, but we leave it concrete for binary compatibility. Knowledgeable providers should override this method.- Overrides:
engineDigestin classMessageDigestSpi- Parameters:
out- the output buffer in which to store the digestofs- offset to start from in the output bufferlen- number of bytes within buf allotted for the digest. Both this default implementation and the SUN provider do not return partial digests. The presence of this parameter is solely for consistency in our API's. If the value of this parameter is less than the actual digest length, the method will throw a DigestException. This parameter is ignored if its value is greater than or equal to the actual digest length.- Returns:
- the length of the digest stored in the output buffer.
- Throws:
DigestException- if an error occurs.
-
-