com.thehackerschoice.shagg
Class Laboratory
java.lang.Object
|
+--com.thehackerschoice.shagg.Laboratory
- public class Laboratory
- extends java.lang.Object
This class is the laboratoy of THC-Shagg. The provided filename is
loaded and parsed. The set of of retrieved serial numbers gets brute-
forced with all implemented check digit algorithms, weights and
partitions.
- Version:
- $Id: Laboratory.java,v 1.2 2001/12/14 14:13:59 plasmoid Exp $
- Author:
- Plasmoid (plasmoid@thehackerschoice.com),
THC
- See Also:
CheckDigitAlgorithm
Constructor Summary |
Laboratory(java.lang.String filename)
Construct a shaggadalic object using the serial numbers from
the provided file. |
Method Summary |
private int[][] |
readSerialNumberFile(java.lang.String filename)
Read all numbers from the given file. |
void |
work()
Bruteforce through the serial numbers. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
algorithms
private CheckDigitAlgorithm[] algorithms
weightSet
private WeightSet weightSet
partitionSet
private PartitionSet partitionSet
serialNumbers
private int[][] serialNumbers
Laboratory
public Laboratory(java.lang.String filename)
- Construct a shaggadalic object using the serial numbers from
the provided file. If the file doesn't contain serial numbers
or numbers of mixed type, Shagg will abort.
- Parameters:
filename
- File containing serial numbers of the same type.
readSerialNumberFile
private int[][] readSerialNumberFile(java.lang.String filename)
- Read all numbers from the given file.
This method looks for serial numbers in each line of the file. Non-
digits are ignored and comments can be added to the file using the
common tags "#" and ";".
The length of the serial numbers is determined automatically. In
case the user has already specified a length, it is check against
the automatic one.
- Parameters:
filename
- Filename containing serial numbers.- Returns:
- Array of serial numbers.
work
public void work()
- Bruteforce through the serial numbers.
This is the laboratories work horse. As described above every
algorithm, weight, partition is checked against every number. Every
combination that matches is called a "state" and stored in a
red-black-tree (can be any databstructure with efficient insertion and
searching, e.g. O(lg n).
After collecting all states, states that donnot match all serial number
(failure tolerance may change this) are removed. In case the collection
gets to be before the end, an emergency clear is issued.