CalculateHashConstantLong

Calculate the constant for the secondary hash function, so that the hash function mixes the input bits as much as possible.

Methods
static void main(String... args)
Run just this test.
static void main(String... args) throws Exception
Run just this test.
Parameters:
args - ignored
int getAvalanche(CalculateHashConstantLong h, long value)
Calculate the number of bits that change if a single bit is changed multiplied by 1000 (expected: 16000 +/- 5%).
int getAvalanche(CalculateHashConstantLong h, long value)
Calculate the number of bits that change if a single bit is changed multiplied by 1000 (expected: 16000 +/- 5%).
Parameters:
h - the hash object
value - the base value
Returns:
the number of bit changes multiplied by 1000
long getCollisionCount()
long getCollisionCount()
int[] getDependencies(CalculateHashConstantLong h, long[] values)
Calculate how much the bit changes (output bits that change if an input bit is changed) are independent of each other.
int[] getDependencies(CalculateHashConstantLong h, long[] values)
Calculate how much the bit changes (output bits that change if an input bit is changed) are independent of each other.
Parameters:
h - the hash object
values - the values to test with
Returns:
the minimum and maximum number of output bits that are changed in combination with another output bit
int[] getEffect(CalculateHashConstantLong h, int count, int seed)
Calculate if the bit changes (that an output bit changes if an input bit is changed) are within a certain range.
int[] getEffect(CalculateHashConstantLong h, int count, int seed)
Calculate if the bit changes (that an output bit changes if an input bit is changed) are within a certain range.
Parameters:
h - the hash object
count - the number of values to test
seed - the random seed
Returns:
the minimum and maximum value of all input-to-output bit changes
long getEffectSquare(CalculateHashConstantLong h, long[] values)
Calculate the sum of the square of the distance to the expected probability that an output bit changes if an input bit is changed.
long getEffectSquare(CalculateHashConstantLong h, long[] values)
Calculate the sum of the square of the distance to the expected probability that an output bit changes if an input bit is changed. The lower the value, the better.
Parameters:
h - the hash object
values - the values to test with
Returns:
sum(distance^2)
long hash(long x)
The hash method.
long hash(long x)
The hash method.
Parameters:
x - the input
Returns:
the output
void run()
void run()
long secureHash(long x)
Calculate a hash using AES.
long secureHash(long x)
Calculate a hash using AES.
Parameters:
x - the input
Returns:
the output
void storeRandomFile()
Store a random file to be analyzed by the Diehard test.
void storeRandomFile() throws Exception
Store a random file to be analyzed by the Diehard test.