public class HMacMd5 extends HMac
This class only instantiates the super HMac
class and specifies
Md5 as hash algorithm to be used.
An application wishing to perform a MAC computation, at first has to create
a MAC object by instantiating the Mac
class through a proper
getInstance
factory method thereby specifying
the MAC algorithm to be used. Calculating a HMAC based on the Md5 hash
algorithm, may be initiated as follows:
Mac md5_HMAC = Mac.getInstance("HMAC/MD5");
After properly initializing the MAC object with one entity's secret key, the
data to be processed is applied by one (or more) calls to the
update
methods. The MAC computation is concluded by using
doFinal
. If the data can be processed without calling any
update
method, doFinal
can be called immediately
after initializing the MAC object:
md5_HMAC.init(secret_key); byte[] mac_data = md5_HMAC.doFinal(data);
After the MAC finally has been calculated, the MAC object automatically is reset for being able to be used for further MAC computations, either by using the same secret key again, or using a new key by properly re-initializing this MAC object.
Constructor and Description |
---|
HMacMd5()
Default constructor.
|
engineDoFinal, engineGetMacLength, engineInit, engineReset, engineUpdate, engineUpdate
public HMacMd5() throws java.security.NoSuchAlgorithmException
HMac
class thereby specifying Md5 as hash function to be used.java.security.NoSuchAlgorithmException
- if there is no implementation for MD5