public class AsconVarMacSpi extends AsconMacSpi
The Ascon message authentication code (MAC) algorithm Ascon-Mac is based on the Ascon pseudorandom function Ascon-Prf.
Ascon-Mac is parameterized by the key length (128-bit), output rate (128-bit), the internal round number (12-rounds), and the tag length (128-bit).
Ascon message authentication modes use the same lightweight 320-bit permutation as the authenticated encryption modes Ascon-128.
The authentication algorithm takes as its input a 128-bit secret key and a message of arbitrary length.
After each absorbed or squeezed block except the last, the intermediate 12-round permutation is applied to the state, processing the plaintext.
Finally, a 128-bit tag is produced as its output. For more details we refer to the official Ascon specification.
Usage example:
// register IAIK-LW provider IaikLw.addAsProvider();// the message to be encrypted byte[] msg = ...;
// generate the secret key
KeyGenerator keyGenerator = KeyGenerator.getInstance("Ascon-Mac");
SecretKey key = keyGenerator.generateKey();
// generate the tag
Mac mac = Mac.getInstance("Ascon-Mac");
mac.init(secretKey);
mac.update(msg);
byte[] result = mac.doFinal();
AsconVarMacASpi,
Ascon128CipherSpi| Constructor and Description |
|---|
AsconVarMacSpi() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getRate()
Gets the block rate for the variant in bytes.
|
protected String |
getVariant()
Gets the variant name.
|
engineDoFinal, engineGetMacLength, engineInit, engineReset, engineUpdate, engineUpdateclone, engineUpdateprotected String getVariant()
getVariant in class AsconMacSpiprotected int getRate()
getRate in class AsconMacSpiCopyright © 2022–2023 Stiftung SIC. All rights reserved.