Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Adding better documentation and a README guide to the project
- Loading branch information
James Shuttleworth
committed
Sep 30, 2021
1 parent
cbfd473
commit 67ffb7c92a98f52945dcdd2ac21851ee2b04c2a1
Showing
5 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,3 +2,4 @@ | ||
/src/__pycache__/ | ||
/rt-venv/ | ||
/src/answer.py | ||
/html/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Pearson Rainbow Table Generator | ||
|
||
## Pearson Hash Function | ||
|
||
The chosen hash function can create hashes of arbitrary length. Here, | ||
we're using just two bytes to limit the size of tables required, but | ||
the same methods would apply for larger hashes. You just need more | ||
time and space. | ||
|
||
## What's in the files? | ||
|
||
### `src/pearson.py` | ||
|
||
Here there are just two functions, and the only one of interest is | ||
`hashN`. | ||
|
||
This function, given a string (the argument called `message`) and a | ||
target number of bytes (`nBytes`), creates a hash of that string that | ||
will be exactly `nBytes` long. | ||
|
||
You can use `asHex` if you want to turn bytes into nicely printable | ||
hex pairs. | ||
|
||
There's also a list of numbers. This is used to pseudo-randomise | ||
bytes. The list is 256 items long, so if you take a byte and swap it | ||
for the byte with value N you find in the list at location N, you have | ||
somehting that looks random. By swaping bytes and including an ofset, | ||
the apparent randomisation is increased because the same byte with a | ||
different offset is not replaced with the same new value. [^1] | ||
|
||
### `src/rMenu.py` | ||
|
||
This is a simple menu system so you can use and test your work. | ||
|
||
You're welcome to read it, but I don't recommend looking for good rpactice here. It's nothing more than a way to quickly access the rainbow table generation and querying funcitons. | ||
|
||
It also lets you save and load tables, so you can save regenerating them constantly. | ||
|
||
### `src/rainbow_generator.py` | ||
|
||
This is the key file for the project. | ||
|
||
Most of the work is done. The functions provided are: | ||
|
||
- `targetHashFunction(value)` takes a value and returns the hash. It wraps the `hashN` function and adds some counting so we can later see how many times it was called and how many collisions[^2] were encountered. | ||
|
||
- `makeGuess(...)` takes a hash value and creates a new input guess. It uses the pseudorandom number generator to select from the digits we have set as valid. It also limits the length of any guess between a given minimum and maximum. | ||
|
||
|
||
|
||
## Footnotes | ||
|
||
[^1]: That was a very basic explanation. The Cryptography module will get into this stuff more. Like, ensuring this "confusion", and how this kind of shuffling (effectively an [S-box](https://en.wikipedia.org/wiki/S-box) is used in more cryptosystems. | ||
|
||
[^2]: How many times we produce a hash that has already been seen. Each time we have a collision, we are at a point where we add no value to the chain, since we already have a way to reverse this hash. Note that the values that produce the hash might not be the same (what we usually mean by a hash collision) but in a rainbow table, could be produced by accidentally generating the same guess twice in the table. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
simple-term-menu | ||
pdoc3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters