Top Description Fields Constructors Methods
org.bouncycastle.crypto.macs

public Class SkeinMac

extends Object
implements Mac
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.Mac
Imports
org.bouncycastle.crypto.CipherParameters, .Mac, org.bouncycastle.crypto.digests.SkeinEngine, org.bouncycastle.crypto.engines.ThreefishEngine, org.bouncycastle.crypto.params.KeyParameter, .SkeinParameters

Implementation of the Skein parameterised MAC function in 256, 512 and 1024 bit block sizes, based on the Threefish tweakable block cipher.

This is the 1.3 version of Skein defined in the Skein hash function submission to the NIST SHA-3 competition in October 2010.

Skein was designed by Niels Ferguson - Stefan Lucks - Bruce Schneier - Doug Whiting - Mihir Bellare - Tadayoshi Kohno - Jon Callas - Jesse Walker.

See Also
SkeinEngine, SkeinParameters

Field Summary

Modifier and TypeField and Description
private SkeinEngine
public static final int
SKEIN_1024

1024 bit block size - Skein MAC-1024

public static final int
SKEIN_256

256 bit block size - Skein MAC-256

public static final int
SKEIN_512

512 bit block size - Skein MAC-512

Constructor Summary

AccessConstructor and Description
public
SkeinMac(int
the internal state size in bits - one of SKEIN_256, SKEIN_512 or SKEIN_1024.
stateSizeBits
,
int
the output/MAC size to produce in bits, which must be an integral number of bytes.
digestSizeBits
)

Constructs a Skein MAC with an internal state size and output size.

public

Method Summary

Modifier and TypeMethod and Description
public int
doFinal(byte[]
the array the MAC is to be output to.
out
,
int
the offset into the out buffer the output is to start at.
outOff
)

Implements org.bouncycastle.crypto.Mac.doFinal.

Compute the final stage of the MAC writing the output to the out parameter.
public String
getAlgorithmName()

Implements org.bouncycastle.crypto.Mac.getAlgorithmName.

Return the name of the algorithm the MAC implements.
public int
getMacSize()

Implements org.bouncycastle.crypto.Mac.getMacSize.

Return the block size for this MAC (in bytes).
public void
init(CipherParameters
an instance of SkeinParameters or KeyParameter.
params
)

Implements org.bouncycastle.crypto.Mac.init.

Initialises the Skein digest with the provided parameters.
public void
reset()

Implements org.bouncycastle.crypto.Mac.reset.

Reset the MAC.
public void
update(byte
the byte to be processed.
in
)

Implements org.bouncycastle.crypto.Mac.update.

add a single byte to the mac for processing.
public void
update(byte[]
the array containing the input.
in
,
int
the index in the array the data begins at.
inOff
,
int
the length of the input starting at inOff.
len
)

Implements org.bouncycastle.crypto.Mac.update.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

engineback to summary
private SkeinEngine engine
SKEIN_1024back to summary
public static final int SKEIN_1024

1024 bit block size - Skein MAC-1024

SKEIN_256back to summary
public static final int SKEIN_256

256 bit block size - Skein MAC-256

SKEIN_512back to summary
public static final int SKEIN_512

512 bit block size - Skein MAC-512

Constructor Detail

SkeinMacback to summary
public SkeinMac(int stateSizeBits, int digestSizeBits)

Constructs a Skein MAC with an internal state size and output size.

Parameters
stateSizeBits:int

the internal state size in bits - one of SKEIN_256, SKEIN_512 or SKEIN_1024.

digestSizeBits:int

the output/MAC size to produce in bits, which must be an integral number of bytes.

SkeinMacback to summary
public SkeinMac(SkeinMac mac)

Method Detail

doFinalback to summary
public int doFinal(byte[] out, int outOff)

Implements org.bouncycastle.crypto.Mac.doFinal.

Doc from org.bouncycastle.crypto.Mac.doFinal.

Compute the final stage of the MAC writing the output to the out parameter.

doFinal leaves the MAC in the same state it was after the last init.

Parameters
out:byte[]

the array the MAC is to be output to.

outOff:int

the offset into the out buffer the output is to start at.

getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.Mac.getAlgorithmName.

Doc from org.bouncycastle.crypto.Mac.getAlgorithmName.

Return the name of the algorithm the MAC implements.

Returns:String

the name of the algorithm the MAC implements.

getMacSizeback to summary
public int getMacSize()

Implements org.bouncycastle.crypto.Mac.getMacSize.

Doc from org.bouncycastle.crypto.Mac.getMacSize.

Return the block size for this MAC (in bytes).

Returns:int

the block size for this MAC in bytes.

initback to summary
public void init(CipherParameters params) throws IllegalArgumentException

Implements org.bouncycastle.crypto.Mac.init.

Initialises the Skein digest with the provided parameters.
See SkeinParameters for details on the parameterisation of the Skein hash function.

Parameters
params:CipherParameters

an instance of SkeinParameters or KeyParameter.

Exceptions
IllegalArgumentException:

Doc from org.bouncycastle.crypto.Mac.init.

if the params argument is inappropriate.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.Mac.reset.

Doc from org.bouncycastle.crypto.Mac.reset.

Reset the MAC. At the end of resetting the MAC should be in the in the same state it was after the last init (if there was one).

updateback to summary
public void update(byte in)

Implements org.bouncycastle.crypto.Mac.update.

Doc from org.bouncycastle.crypto.Mac.update.

add a single byte to the mac for processing.

Parameters
in:byte

the byte to be processed.

updateback to summary
public void update(byte[] in, int inOff, int len)

Implements org.bouncycastle.crypto.Mac.update.

Parameters
in:byte[]

Doc from org.bouncycastle.crypto.Mac.update.

the array containing the input.

inOff:int

Doc from org.bouncycastle.crypto.Mac.update.

the index in the array the data begins at.

len:int

Doc from org.bouncycastle.crypto.Mac.update.

the length of the input starting at inOff.