The Wayback Machine - https://web.archive.org/web/20241125012827/https://www.geeksforgeeks.org/understanding-rainbow-table-attack/
Open In App

Understanding Rainbow Table Attack

Last Updated : 10 Feb, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

What is a Rainbow Table?

The passwords in a computer system are not stored directly as plain texts but are hashed using encryption. A hash function is a 1-way function, which means that it can’t be decrypted. Whenever a user enters a password, it is converted into a hash value and is compared with the already stored hash value. If the values match, the user is authenticated. 
A rainbow table is a database that is used to gain authentication by cracking the password hash. It is a precomputed dictionary of plaintext passwords and their corresponding hash values that can be used to find out what plaintext password produces a particular hash. Since more than one text can produce the same hash, it’s not important to know what the original password really was, as long as it produces the same hash. 

How does the Rainbow Table Attack work?

A rainbow table works by doing a cryptanalysis very quickly and effectively. Unlike bruteforce attack, which works by calculating the hash function of every string present with them, calculating their hash value and then compare it with the one in the computer, at every step. A rainbow table attack eliminates this need by already computing hashes of the large set of available strings. There are two main steps in this: 

Creating a Table 
Here, the hash of a string is taken and then reduced to create a new string, which is reduced again, repeatedly. For example, let’s create a table of the most common password, 12345678, using MD5 hash function on first 8 characters: 

  • First we take the string and pass it through md5 hash function. 
hashMD5(12345678) = 25d55ad283aa400af464c76d713c07ad
  • We reduce the hash by taking only the first 8 characters. Then, we re-hash it. 
hashMD5(25d55ad2) = 5c41c6b3958e798662d8853ece970f70
  • This is repeated until enough hashes in output chain. This represents one chain, which starts from the first plain text and ends at the last hash.
  • After obtaining enough chains, we store them in a table.

Cracking the Password 
Starting off with the hashed text (the password) is checked if it exists in the database. If so, go to the start of the chain and start hashing until there is a match. As soon as the match is obtained, the process ceases and the authentication is cracked. The following flowchart explains the steps: 

Advantages and Disadvantages of Rainbow Table Attack

Advantages:  

  1. Unlike brute-forcing, performing the hash function isn’t the problem here (since everything is precomputed). With all of the values already computed, it’s simplified to just a simple search-and-compare operation on the table.
  2. The exact password string isn’t needed to be known. If the hash is matched, it doesn’t matter if the string isn’t the password itself. It will be authenticated.

Disadvantages:  

  1. A large amount of storage is required for store tables.
  2. With all of the values already computed, it’s simplified to just a simple search-and-compare operation on the table.

Defense against Rainbow Table Attacks

Rainbow table attacks can easily be prevented by using salt techniques, which is a random data that is passed into the hash function along with the plain text. This ensures that every password has a unique generated hash and hence, rainbow table attack, which works on the principle that more than one text can have the same hash value, is prevented. 

Another technique that helps prevent precomputation attacks is key stretching. Using this, the salt, the password, and some intermediate hash values are run through the hash function multiple times to increase the computation time required to hash each password. An alternative approach, called key strengthening, extends the key with a random salt, but then (unlike in key stretching) securely deletes the salt. This forces both the attacker and legitimate users to perform a brute-force search for the salt value. Therefore, there is no point of bypassing salting.
 


Previous Article
Next Article

Similar Reads

Understanding ReDoS Attack
ReDoS stands for Regular Expression Denial of Service. The ReDoS is an algorithmic complexity attack that produces a denial of service by providing a regular expression that takes a very long time to evaluate. The attack exploits the fact that most regular expression implementations have exponential time worst case complexity, so for larger input s
3 min read
Birthday attack in Cryptography
Prerequisite - Birthday paradox Birthday attack is a type of cryptographic attack that belongs to a class of brute force attacks. It exploits the mathematics behind the birthday problem in probability theory. The success of this attack largely depends upon the higher likelihood of collisions found between random attack attempts and a fixed degree o
6 min read
Program to perform a letter frequency attack on a monoalphabetic substitution cipher
Given a string S of size N representing a monoalphabetic cipher, the task is to print the top five possible plain texts that can be decrypted from the given monoalphabetic cipher using a letter frequency attack. Examples: Input: S = "ETAOINSHRDLCUMWFGYPBVKJXQZ"Output: A SIMPLE MESSAGE B TJNQMF NFTTBHF A SIMPLE MESSAGE C UKORNG OGUUCIG C UKORNG OGUU
13 min read
Understanding basic JavaScript code
Inserting JavaScript into a webpage is much like inserting any other HTML content. The tags used to add JavaScript in HTML are <script> and </script>. The code surrounded by the <script> and </script> tags is called a script blog. <script> tags can be put between the <head> and </head> tags or between <b
3 min read
Understanding Digital Rights Management
What is Digital Rights Management? Digital rights management a.k.a DRM is a set of technology standards that enable the manufacturers of software applications, digital media to enforce access controls on their product(s), such as restriction on the usage, reproduction, modification, and distribution of the product. Why is DRM tech used? Software co
5 min read
Understanding Augmented Reality
The release of Pokémon Go in 2016 brought the childhood desires of most people into existence. Being able to do, what we could only dream of, was an aspect of pure excitement. But the crucial factor behind all of it was the incorporation of Augmented Reality. Yes, Augmented Reality, in short AR, is what allows us to feel the existence of those ador
3 min read
Understanding Tensor Processing Units
What is a Tensor Processing Unit? With machine learning gaining its relevance and importance everyday, the conventional microprocessors have proven to be unable to effectively handle it, be it training or neural network processing. GPUs, with their highly parallel architecture designed for fast graphic processing proved to be way more useful than C
2 min read
Factless Fact Table
Factless tables simply mean the key available in the fact that no remedies are available. Factless fact tables are only used to establish relationships between elements of different dimensions. And are also useful for describing events and coverage, meaning tables contain information that nothing has happened. It often represents many-to-many relat
4 min read
Table | Guava | Java
Guava’s Table is a collection that represents a table like structure containing rows, columns and the associated cell values. The row and the column act as an ordered pair of keys. The row and column act as an ordered pair of keys. If we have to manage this the traditional way then the structure would be a map of rows where each row contain a map o
3 min read
How to Get Column from One Table to another in Power Bi
Real-world data is always messy. There will be always in need for adding new columns from one table to another because no table will have complete information. Adding a column allows for more efficient data analysis as well as the ability to add additional information to the table. Adding a column from one table to another helps us to combine data
4 min read
Creating a NoSQL Table Using Amazon DynamoDB
Pre-requisite: DynamoDB Amazon DynamoDB is a fully managed NoSQL database provided by amazon that supports both document and key-value stored data. In this article, we will learn how to create a table, add data, scan, a query that table, and delete the data by using the DynamoDB console. Benefits of Using DynamoDB:When the load increases automatic
2 min read
Inverted Page Table in Operating System
Most Operating Systems implement a separate page table for each process, i.e. for the 'n' number of processes running on a Multiprocessing/ Timesharing Operating System, there is an 'n' number of page tables stored in the memory. Sometimes when a process is very large and it occupies virtual memory then with the size of the process, its page table
7 min read
Introduction to Electronic Mail
Introduction:Electronic mail, commonly known as email, is a method of exchanging messages over the internet. Here are the basics of email:An email address: This is a unique identifier for each user, typically in the format of name@domain.com.An email client: This is a software program used to send, receive and manage emails, such as Gmail, Outlook,
4 min read
Java IO : Input-output in Java with Examples
Java brings various Streams with its I/O package that helps the user to perform all the input-output operations. These streams support all the types of objects, data-types, characters, files etc to fully execute the I/O operations. Before exploring various input and output streams lets look at 3 standard or default streams that Java has to provide
7 min read
Building Heap from Array
Given an array of N elements. The task is to build a Binary Heap from the given array. The heap can be either Max Heap or Min Heap. Examples: Input: arr[] = {4, 10, 3, 5, 1}Output: Corresponding Max-Heap: 10 / \ 5 3 / \4 1 Input: arr[] = {1, 3, 5, 4, 6, 13, 10, 9, 8, 15, 17}Output: Corresponding Max-Heap: 17 / \ 15 13 / \ / \ 9 6 5 10 / \ / \ 4 8 3
14 min read
Insertion and Deletion in Heaps
Deletion in Heap:Given a Binary Heap and an element present in the given Heap. The task is to delete an element from this Heap. The standard deletion operation on Heap is to delete the element present at the root node of the Heap. That is if it is a Max Heap, the standard deletion operation will delete the maximum element and if it is a Min heap, i
15+ min read
6V's of Big Data
In recent years, Big Data was defined by the “3Vs” but now there is “6Vs” of Big Data which are also termed as the characteristics of Big Data as follows: 1. Volume: The name ‘Big Data’ itself is related to a size which is enormous.Volume is a huge amount of data.To determine the value of data, size of data plays a very crucial role. If the volume
3 min read
Association Rule
Association rule mining finds interesting associations and relationships among large sets of data items. This rule shows how frequently a itemset occurs in a transaction. A typical example is a Market Based Analysis. Market Based Analysis is one of the key techniques used by large relations to show associations between items.It allows retailers to
3 min read
Data encryption standard (DES) | Set 1
This article talks about the Data Encryption Standard (DES), a historic encryption algorithm known for its 56-bit key length. We explore its operation, key transformation, and encryption process, shedding light on its role in data security and its vulnerabilities in today's context. What is DES?Data Encryption Standard (DES) is a block cipher with
15+ min read
Priority Queue in Python
Priority Queues are abstract data structures where each data/value in the queue has a certain priority. For example, In airlines, baggage with the title “Business” or “First-class” arrives earlier than the rest. Priority Queue is an extension of the queue with the following properties. An element with high priority is dequeued before an element wit
2 min read
Introduction to Internet of Things (IoT) - Set 1
IoT stands for Internet of Things. It refers to the interconnectedness of physical devices, such as appliances and vehicles, that are embedded with software, sensors, and connectivity which enables these objects to connect and exchange data. This technology allows for the collection and sharing of data from a vast network of devices, creating oppor
9 min read
Services and Segment structure in TCP
The Transmission Control Protocol is the most common transport layer protocol. It works together with IP and provides a reliable transport service between processes using the network layer service provided by the IP protocol. The various services provided by the TCP to the application layer are as follows: Process-to-Process Communication - TCP pro
5 min read
Block Cipher modes of Operation
Encryption algorithms are divided into two categories based on the input type, as a block cipher and stream cipher. Block cipher is an encryption algorithm that takes a fixed size of input say b bits and produces a ciphertext of b bits again. If the input is larger than b bits it can be divided further. For different applications and uses, there ar
5 min read
Carrier Sense Multiple Access (CSMA)
Carrier Sense Multiple Access (CSMA) is a method used in computer networks to manage how devices share a communication channel to transfer the data between two devices. In this protocol, each device first sense the channel before sending the data. If the channel is busy, the device waits until it is free. This helps reduce collisions, where two dev
9 min read
Z-Buffer or Depth-Buffer method
When viewing a picture containing non transparent objects and surfaces, it is not possible to see those objects from view which are behind from the objects closer to eye. To get the realistic screen image, removal of these hidden surfaces is must. The identification and removal of these surfaces is called as the Hidden-surface problem. Z-buffer, wh
5 min read
Converting Context Free Grammar to Chomsky Normal Form
Prerequisite - Simplifying Context Free Grammars A context free grammar (CFG) is in Chomsky Normal Form (CNF) if all production rules satisfy one of the following conditions: A non-terminal generating a terminal (e.g.; X->x) A non-terminal generating two non-terminals (e.g.; X->YZ) Start symbol generating ε. (e.g.; S-> ε) Consider the following gra
4 min read
Computer Architecture | Flynn's taxonomy
Parallel computing is a computing where the jobs are broken into discrete parts that can be executed concurrently. Each part is further broken down to a series of instructions. Instructions from each part execute simultaneously on different CPUs. Parallel systems deal with the simultaneous use of multiple computer resources that can include a singl
4 min read
Carry Look-Ahead Adder
The adder produce carry propagation delay while performing other arithmetic operations like multiplication and divisions as it uses several additions or subtraction steps. This is a major problem for the adder and hence improving the speed of addition will improve the speed of all other arithmetic operations. Hence reducing the carry propagation de
5 min read
Difference Between Structure and Union in C
Structures in C is a user-defined data type available in C that allows to combining of data items of different kinds. Structures are used to represent a record. Defining a structure: To define a structure, you must use the struct statement. The struct statement defines a new data type, with more than or equal to one member. The format of the struct
4 min read
File Allocation Methods
The allocation methods define how the files are stored in the disk blocks. There are three main disk space or file allocation methods. Contiguous Allocation Linked Allocation Indexed Allocation The main idea behind these methods is to provide: Efficient disk space utilization. Fast access to the file blocks. All the three methods have their own adv
5 min read
Article Tags :
Practice Tags :
three90RightbarBannerImg