What are Rainbow Tables?

Do you know what’s a Rainbow table. Well if you are an amateur hacker like i once was, a rainbow table is a huge pre-computed list of hash values for every possible combination of characters. A password hash is a password that has gone through a mathematical algorithm that transformed it into something absolutely foreign and when i mean foreign i mean it looks like some hieroglyphics stuff that you would see on those egyptian pyramids, well that was when i just started out but don’t worry if you’re a amateur you will pass that stage soon. A hash is a one way encryption so once a password is hashed there is no way to get the original string from the hashed string. A very common hashing algorithm used as to store passwords in website databases is MD5.
What are Rainbow Tables?
If you are confused like i once was couple years ago well here is a scenario, Let’s say you are registering for a website which I did couple weeks ago. You put in a username and password. Now when you submit, your password goes through the MD5 algorithm and the outcome hash is stored in a database. Now since you can’t get the password from the hash, you may be wondering how they know if your password is right when you login. Well when you login and submit your username and password, a script takes your password and runs it through the md5 algorithm. The outcome hash is compared to the hash stored in the database. If they are the same, you are admitted plain and simple.
If I were to run the word “cheese” through the md5 algorithm, the outcome would be (fea0f1f6fede90bd0a925b4194deac11) yep that’s what called those weird looking stuff. Having huge tables of every possible character combination hashed is a much better alternative to brute-force cracking. Once the rainbow tables are created, cracking the password is a hundred times faster than brute-forcing it. You can avoid rainbow table cracking by simply making your password extremely long. Creating tables for passwords that are long takes a very long time and a lot of resources. That is why there aren’t many of these tables available.
Constructing a rainbow table requires two things, a hashing function and a reduction function. The hashing function for a given  of Rainbow Table must match the hashed password you want to recover if it don’t well you already the drill. The reduction function must transform a hash into something usable as a password. A simple reduction function is to Base64 encode the hash, then truncate it to a certain number of characters.
Rainbow tables are constructed of “chains” of a certain length: 100,000 for example. To construct the chain, pick a random seed value. Then apply the hashing and reduction functions to this seed, and its output, and continue iterating 100,000 times. Only the seed and final value are stored. Repeat this process to create as many chains as desired.
To recover a password using Rainbow Tables, the password undergoes the above process for the same length: in this case 100,000 but each link in the chain is retained. Each link in the chain is compared with the final value of each chain. If there is a match, well  the chain can be reconstructed, keeping both the output of each hashing function and the output of each reduction function. That reconstructed chain will contain the hash of the password in question as well as the password that produced it.
Rainbow Tables have the benefit, the person constructing those tables can choose how much storage is required by selecting the number of links in each chain. The more links between the seed and the final value, the more passwords are captured. One weakness is that the person building the chains doesn’t choose the passwords they capture so Rainbow Tables can’t be optimized for common passwords. Also, password recovery involves computing long chains of hashes, making recovery an expensive operation. The longer the chains, the more passwords are captured in them, but more time is required to find a password inside.So there you have it i hope you learnt something valuable.