nl.warper.skein
Class Skein.Tweak

java.lang.Object
  extended by nl.warper.skein.Skein.Tweak
Enclosing class:
Skein

public static class Skein.Tweak
extends java.lang.Object

Calculates the tweak values according to the various tweak fields. This class is for initial calculations only, it's too slow for general calculation of tweak values. Warning: due to lsb mode you can easily confuse tweakHigh and tweakLow. T[0] actually contains the position (0..2^64 at least) and T[1] the type etc.

Since:
5 nov 2008
Version:
$Revision: $
Author:
maartenb, $Author: $

Field Summary
static int BIT_PAD_LOCATION_IN_T1
           
static int FINAL_LOCATION_IN_T1
           
static int FIRST_LOCATION_IN_T1
           
static java.math.BigInteger MAXIMUM_POSITION_VALUE_PLUS_ONE
           
static int T_CFG
           
static int T_KDF
           
static int T_KEY
           
static int T_MSG
           
static int T_NON
           
static int T_OUT
           
static int T_PK
           
static int T_PRS
           
static int TYPE_LOCATION_IN_T1
           
 
Constructor Summary
Skein.Tweak(boolean isFinal, boolean isFirst, int type, boolean bitPadded, java.math.BigInteger position)
           
Skein.Tweak(boolean isFinal, boolean isFirst, int type, boolean bitPadded, int treeLevel, long position)
          Convenience constructor that works for values in the range [0..2^64-1], encoded in the long parameter position as an unsigned value.
Skein.Tweak(long t0, long t1)
           
 
Method Summary
 long getT0()
          Note that because of the LSB configuration of the hash method, the low tweak value must come to the left of the high tweak value (visualize the lowest byte containing the lowest part of the position completely to the left).
 long getT1()
          Note that because of the LSB configuration of the hash method, the low tweak value must come to the left of the high tweak value (visualize the lowest byte containing the lowest part of the position completely to the left).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXIMUM_POSITION_VALUE_PLUS_ONE

public static final java.math.BigInteger MAXIMUM_POSITION_VALUE_PLUS_ONE

FINAL_LOCATION_IN_T1

public static final int FINAL_LOCATION_IN_T1
See Also:
Constant Field Values

FIRST_LOCATION_IN_T1

public static final int FIRST_LOCATION_IN_T1
See Also:
Constant Field Values

TYPE_LOCATION_IN_T1

public static final int TYPE_LOCATION_IN_T1
See Also:
Constant Field Values

BIT_PAD_LOCATION_IN_T1

public static final int BIT_PAD_LOCATION_IN_T1
See Also:
Constant Field Values

T_KEY

public static final int T_KEY
See Also:
Constant Field Values

T_CFG

public static final int T_CFG
See Also:
Constant Field Values

T_PRS

public static final int T_PRS
See Also:
Constant Field Values

T_PK

public static final int T_PK
See Also:
Constant Field Values

T_KDF

public static final int T_KDF
See Also:
Constant Field Values

T_NON

public static final int T_NON
See Also:
Constant Field Values

T_MSG

public static final int T_MSG
See Also:
Constant Field Values

T_OUT

public static final int T_OUT
See Also:
Constant Field Values
Constructor Detail

Skein.Tweak

public Skein.Tweak(boolean isFinal,
                   boolean isFirst,
                   int type,
                   boolean bitPadded,
                   int treeLevel,
                   long position)
Convenience constructor that works for values in the range [0..2^64-1], encoded in the long parameter position as an unsigned value.

Parameters:
isFinal - indicates this is the tweak value of the final block to be processed
isFirst - indicates this is the tweak value of the fist block to be processed
type - the type contained in the block
bitPadded - the last byte in the block uses the indicated bit padding (see class description)
treeLevel - the level in the tree of this block
position - the number of bytes processed so far including the unpadded bytes in this block

Skein.Tweak

public Skein.Tweak(boolean isFinal,
                   boolean isFirst,
                   int type,
                   boolean bitPadded,
                   java.math.BigInteger position)

Skein.Tweak

public Skein.Tweak(long t0,
                   long t1)
Method Detail

getT0

public long getT0()
Note that because of the LSB configuration of the hash method, the low tweak value must come to the left of the high tweak value (visualize the lowest byte containing the lowest part of the position completely to the left).

Returns:
the lowest part of the tweak value

getT1

public long getT1()
Note that because of the LSB configuration of the hash method, the low tweak value must come to the left of the high tweak value (visualize the lowest byte containing the lowest part of the position completely to the left).

Returns:
the highest part of the tweak value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object