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 |
|---|---|
| private static class | |
| public static class | |
| private class | SkeinEngine.
The Unique Block Iteration chaining mode. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long[] | chain
The current chaining/state value |
| private static final Hashtable | INITIAL_STATES
Precalculated UBI(CFG) states for common state/output combinations without key or other pre-message params. |
| private long[] | initialState
The initial state value |
| private byte[] | key
The (optional) key parameter |
| private final int | outputSizeBytes
Size of the digest output, in bytes |
| private static final int | PARAM_TYPE_CONFIG
The parameter type for the Skein configuration block. |
| private static final int | PARAM_TYPE_KEY
The parameter type for the Skein key. |
| private static final int | PARAM_TYPE_MESSAGE
The parameter type for the message. |
| private static final int | PARAM_TYPE_OUTPUT
The parameter type for the output transformation. |
| private SkeinEngine. | postMessageParameters
Parameters to apply after the message, but prior to output |
| private SkeinEngine. | preMessageParameters
Parameters to apply prior to the message |
| private final byte[] | singleByte
Buffer for single byte update method |
| public static final int | SKEIN_1024
1024 bit block size - Skein 1024 |
| public static final int | SKEIN_256
256 bit block size - Skein 256 |
| public static final int | SKEIN_512
512 bit block size - Skein 512 |
| pack-priv final ThreefishEngine | threefish
Underlying Threefish tweakable block cipher |
| private final SkeinEngine. | ubi
The current UBI operation |
| Access | Constructor and Description |
|---|---|
| public | SkeinEngine(int blockSizeBits, int
the output/digest size to produce in bits, which must be an integral number of
bytes. outputSizeBits)Constructs a Skein engine. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private static SkeinEngine. | |
| public Memoable | copy()
Implements org. Produce a copy of this object with its configuration and in its current state. |
| private void | |
| private void | |
| public int | |
| public int | |
| public int | |
| public void | init(SkeinParameters
the parameters to apply to this engine, or params)null to use no parameters.Initialises the Skein engine with the provided parameters. |
| private static void | |
| private void | |
| private void | |
| public void | reset(Memoable
an object originally other)copied from an object of the same type as this instance.Implements org. Restore a copied object state into this object. |
| public void | reset()
Reset the engine to the initial state (with the key and any pre-message parameters , ready to accept message input. |
| private static void | |
| private void | |
| private void | |
| private void | |
| public void | |
| public void | |
| private static Integer |
| chain | back to summary |
|---|---|
| pack-priv long[] chain The current chaining/state value | |
| INITIAL_STATES | back to summary |
|---|---|
| private static final Hashtable<K, V> INITIAL_STATES Precalculated UBI(CFG) states for common state/output combinations without key or other pre-message params. | |
| initialState | back to summary |
|---|---|
| private long[] initialState The initial state value | |
| key | back to summary |
|---|---|
| private byte[] key The (optional) key parameter | |
| outputSizeBytes | back to summary |
|---|---|
| private final int outputSizeBytes Size of the digest output, in bytes | |
| PARAM_TYPE_CONFIG | back to summary |
|---|---|
| private static final int PARAM_TYPE_CONFIG The parameter type for the Skein configuration block. | |
| PARAM_TYPE_KEY | back to summary |
|---|---|
| private static final int PARAM_TYPE_KEY The parameter type for the Skein key. | |
| PARAM_TYPE_MESSAGE | back to summary |
|---|---|
| private static final int PARAM_TYPE_MESSAGE The parameter type for the message. | |
| PARAM_TYPE_OUTPUT | back to summary |
|---|---|
| private static final int PARAM_TYPE_OUTPUT The parameter type for the output transformation. | |
| postMessageParameters | back to summary |
|---|---|
| private SkeinEngine. Parameters to apply after the message, but prior to output | |
| preMessageParameters | back to summary |
|---|---|
| private SkeinEngine. Parameters to apply prior to the message | |
| singleByte | back to summary |
|---|---|
| private final byte[] singleByte Buffer for single byte update method | |
| SKEIN_1024 | back to summary |
|---|---|
| public static final int SKEIN_1024 1024 bit block size - Skein 1024 | |
| SKEIN_256 | back to summary |
|---|---|
| public static final int SKEIN_256 256 bit block size - Skein 256 | |
| SKEIN_512 | back to summary |
|---|---|
| public static final int SKEIN_512 512 bit block size - Skein 512 | |
| threefish | back to summary |
|---|---|
| pack-priv final ThreefishEngine threefish Underlying Threefish tweakable block cipher | |
| ubi | back to summary |
|---|---|
| private final SkeinEngine. The current UBI operation | |
| SkeinEngine | back to summary |
|---|---|
| public SkeinEngine(int blockSizeBits, int outputSizeBits) Constructs a Skein engine.
| |
| SkeinEngine | back to summary |
|---|---|
| public SkeinEngine(SkeinEngine engine) Creates a SkeinEngine as an exact copy of an existing instance. | |
| checkInitialised | back to summary |
|---|---|
| private void checkInitialised() | |
| clone | back to summary |
|---|---|
| private static SkeinEngine. | |
| copy | back to summary |
|---|---|
| public Memoable copy() Implements org. Doc from org. Produce a copy of this object with its configuration and in its current state. The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state. | |
| copyIn | back to summary |
|---|---|
| private void copyIn(SkeinEngine engine) | |
| createInitialState | back to summary |
|---|---|
| private void createInitialState() Calculate the initial (pre message block) chaining state. | |
| doFinal | back to summary |
|---|---|
| public int doFinal(byte[] out, int outOff) | |
| getBlockSize | back to summary |
|---|---|
| public int getBlockSize() | |
| getOutputSize | back to summary |
|---|---|
| public int getOutputSize() | |
| init | back to summary |
|---|---|
| public void init(SkeinParameters params) Initialises the Skein engine with the provided parameters. See
| |
| initialState | back to summary |
|---|---|
| private static void initialState(int blockSize, int outputSize, long[] state) | |
| initParams | back to summary |
|---|---|
| private void initParams(Hashtable<K, V> parameters) | |
| output | back to summary |
|---|---|
| private void output(long outputSequence, byte[] out, int outOff, int outputBytes) | |
| reset | back to summary |
|---|---|
| public void reset(Memoable other) Implements org. Doc from org. Restore a copied object state into this object. Implementations of this method should try to avoid or minimise memory allocation to perform the reset. | |
| reset | back to summary |
|---|---|
| public void reset() Reset the engine to the initial state (with the key and any pre-message parameters , ready to accept message input. | |
| sort | back to summary |
|---|---|
| private static void sort(SkeinEngine. | |
| ubiComplete | back to summary |
|---|---|
| private void ubiComplete(int type, byte[] value) | |
| ubiFinal | back to summary |
|---|---|
| private void ubiFinal() | |
| ubiInit | back to summary |
|---|---|
| private void ubiInit(int type) | |
| update | back to summary |
|---|---|
| public void update(byte in) | |
| update | back to summary |
|---|---|
| public void update(byte[] in, int inOff, int len) | |
| variantIdentifier | back to summary |
|---|---|
| private static Integer variantIdentifier(int blockSizeBytes, int outputSizeBytes) | |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] |
| bytes | back to summary |
|---|---|
| private byte[] bytes | |
| Configuration | back to summary |
|---|---|
| public Configuration(long outputSizeBits) | |
| getBytes | back to summary |
|---|---|
| public byte[] getBytes() | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public byte[] |
| Parameter | back to summary |
|---|---|
| public Parameter(int type, byte[] value) | |
| getType | back to summary |
|---|---|
| public int getType() | |
| getValue | back to summary |
|---|---|
| public byte[] getValue() | |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | currentBlock
Buffer for the current block of message data |
| private int | currentOffset
Offset into the current message block |
| private long[] | message
Buffer for message words for feedback into encrypted block |
| private final SkeinEngine. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| public void | |
| public void | |
| public void |
| currentBlock | back to summary |
|---|---|
| private byte[] currentBlock Buffer for the current block of message data | |
| currentOffset | back to summary |
|---|---|
| private int currentOffset Offset into the current message block | |
| message | back to summary |
|---|---|
| private long[] message Buffer for message words for feedback into encrypted block | |
| tweak | back to summary |
|---|---|
| private final SkeinEngine. | |
| UBI | back to summary |
|---|---|
| public UBI(int blockSize) | |
| doFinal | back to summary |
|---|---|
| public void doFinal(long[] output) | |
| processBlock | back to summary |
|---|---|
| private void processBlock(long[] output) | |
| reset | back to summary |
|---|---|
| public void reset(SkeinEngine. | |
| reset | back to summary |
|---|---|
| public void reset(int type) | |
| update | back to summary |
|---|---|
| public void update(byte[] value, int offset, int len, long[] output) | |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | extendedPosition
Whether 64 bit position exceeded |
| private static final long | LOW_RANGE
Point at which position might overflow long, so switch to add with carry logic |
| private static final long | T1_FINAL
Bit 127 = final |
| private static final long | T1_FIRST
Bit 126 = first |
| private long[] | tweak
UBI uses a 128 bit tweak |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | |
| public long[] | |
| public boolean | |
| public boolean | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public String |
| extendedPosition | back to summary |
|---|---|
| private boolean extendedPosition Whether 64 bit position exceeded | |
| LOW_RANGE | back to summary |
|---|---|
| private static final long LOW_RANGE Point at which position might overflow long, so switch to add with carry logic | |
| T1_FINAL | back to summary |
|---|---|
| private static final long T1_FINAL Bit 127 = final | |
| T1_FIRST | back to summary |
|---|---|
| private static final long T1_FIRST Bit 126 = first | |
| tweak | back to summary |
|---|---|
| private long[] tweak UBI uses a 128 bit tweak | |
| UbiTweak | back to summary |
|---|---|
| public UbiTweak() | |
| advancePosition | back to summary |
|---|---|
| public void advancePosition(int advance) Advances the position in the tweak by the specified value. | |
| getType | back to summary |
|---|---|
| public int getType() | |
| getWords | back to summary |
|---|---|
| public long[] getWords() | |
| isFinal | back to summary |
|---|---|
| public boolean isFinal() | |
| isFirst | back to summary |
|---|---|
| public boolean isFirst() | |
| reset | back to summary |
|---|---|
| public void reset(SkeinEngine. | |
| reset | back to summary |
|---|---|
| public void reset() | |
| setFinal | back to summary |
|---|---|
| public void setFinal(boolean last) | |
| setFirst | back to summary |
|---|---|
| public void setFirst(boolean first) | |
| setType | back to summary |
|---|---|
| public void setType(int type) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |