public class SkeinEngine extends java.lang.Object implements Memoable
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.
This implementation is the basis for SkeinDigest
and SkeinMac
, implementing the
parameter based configuration system that allows Skein to be adapted to multiple applications.
Initialising the engine with SkeinParameters
allows standard and arbitrary parameters to
be applied during the Skein hash function.
Implemented:
Not implemented:
SkeinParameters
Modifier and Type | Class and Description |
---|---|
static class |
SkeinEngine.Parameter |
Modifier and Type | Field and Description |
---|---|
static int |
SKEIN_1024
1024 bit block size - Skein 1024
|
static int |
SKEIN_256
256 bit block size - Skein 256
|
static int |
SKEIN_512
512 bit block size - Skein 512
|
Constructor and Description |
---|
SkeinEngine(int blockSizeBits,
int outputSizeBits)
Constructs a Skein engine.
|
SkeinEngine(SkeinEngine engine)
Creates a SkeinEngine as an exact copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
Memoable |
copy()
Produce a copy of this object with its configuration and in its current state.
|
int |
doFinal(byte[] out,
int outOff) |
int |
getBlockSize() |
int |
getOutputSize() |
void |
init(SkeinParameters params)
Initialises the Skein engine with the provided parameters.
|
void |
reset()
Reset the engine to the initial state (with the key and any pre-message parameters , ready to
accept message input.
|
void |
reset(Memoable other)
Restore a copied object state into this object.
|
void |
update(byte in) |
void |
update(byte[] in,
int inOff,
int len) |
public static final int SKEIN_256
public static final int SKEIN_512
public static final int SKEIN_1024
public SkeinEngine(int blockSizeBits, int outputSizeBits)
blockSizeBits
- the internal state size in bits - one of SKEIN_256
, SKEIN_512
or
SKEIN_1024
.outputSizeBits
- the output/digest size to produce in bits, which must be an integral number of
bytes.public SkeinEngine(SkeinEngine engine)
public Memoable copy()
Memoable
The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state.
public void reset(Memoable other)
Memoable
Implementations of this method should try to avoid or minimise memory allocation to perform the reset.
public int getOutputSize()
public int getBlockSize()
public void init(SkeinParameters params)
SkeinParameters
for
details on the parameterisation of the Skein hash function.params
- the parameters to apply to this engine, or null
to use no parameters.public void reset()
public void update(byte in)
public void update(byte[] in, int inOff, int len)
public int doFinal(byte[] out, int outOff)