public class HMacSha512_256 extends HMac
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 SHA512 hash algorithm, may
be initiated as follows:
Mac mac = Mac.getInstance("HMAC/SHA512-256");
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:
mac.init(secret_key); byte[] mac_data = mac.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 |
---|
HMacSha512_256()
Default constructor.
|
engineDoFinal, engineGetMacLength, engineInit, engineReset, engineUpdate, engineUpdate