To be sure I well understood the Rainbow Tables, I've decided to make a little project in Java, but I"m stuck on a question : how to choose the size of the chain ? And this will give the number of lines to get a good percentage of coverage
Imagine I use password size =6
and space 0123456789
, the possibilities are 1 000 000
(size and space are low because it's easier to train on and debug, on a big space it would be harder, I wait to have something that work to try on bigger)
How do I choose between :
- 4000 chains of size 250
- 1000 chains of 1000
- 400 chains of size 2500
- ...
I'm using sha1
to hash, and to reduce I take the 6 first digits and add an index
value (comes from the chain's loop)
public static String reduce(String hash, BigInteger spaceSize, int passSize, int indexFunction) {
int v = BigInteger.valueOf((Long.parseLong(hash.replaceAll("\\D", "").substring(0, passSize), 10) + indexFunction)).mod(spaceSize).intValueExact();
DecimalFormat format = new DecimalFormat("000000");
return format.format(v);
}