public class AsconVarPrfShortSpi extends AsconMacSpi
Ascon-PrfShort is a fast short-input PRF for messages up to 128 bits.
This Prf variant operates only on short inputs ≤ 128 bits, producing outputs of short length ≤ 128 bits.
The mode of operation of Ascon-PrfShort is essentially the initialization of Ascon-128
with a different initial value, and the nonce is replaced by a single message block of length ≤ 128 bits.
The authentication algorithm takes as its input a 128-bit secret key and a message of arbitrary length ≤ 128 bits.
Further, the length of the tag (≤ 128 bits) is chosen by the user and passed to the PRF instance with the AsconParameterSpec.
Finally, it produces a tag 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 processed byte[] msg = ...;
// generate the secret key
KeyGenerator keyGenerator = KeyGenerator.getInstance("Ascon-PrfShort");
SecretKey key = keyGenerator.generateKey();
// generate a AsconParameterSpec specifying the tag length int tagLength = ...; AsconParameterSpec parameterSpec = new AsconParameterSpec(tagLength);
// generate the tag
Mac prf = Mac.getInstance("Ascon-PrfShort");
prf.init(secretKey, parameterSpec);
prf.update(msg);
byte[] result = prf.doFinal();
Ascon128CipherSpi,
AsconParameterSpec| Constructor and Description |
|---|
AsconVarPrfShortSpi() |
| 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.