Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the rainbow table attack based on the following hash function and reduce functions. Let p (for PIN) be an integer between 0000 and 9999

Implement the rainbow table attack based on the following hash function and reduce functions. Let p (for PIN) be an integer between 0000 and 9999 inclusive.

hash(p) = b((p+25) mod 10000)2 100 c mod 10000

reduce(h) = h Run your attack against all 10000 possible PINs.

What is the success rate of your rainbow attack?

This is what I have so far is this properly measuring my success rate?

import java.io.IOException; import java.util.Random;

public class RainbowAttack { public static void main(String[] args) throws IOException { int RainbowTable[][] = new int [100][2]; int[] pins = new Random().ints(0,9999).distinct().limit(100).toArray(); //System.out.print(pins); for(int i = 0; i < 100; ++i){ int hash; hash = pins[i]; RainbowTable[i][0] = hash; for(int j = 0; j < 100; j++) { hash = RainbowTable[i][0]; hash = hash(hash); hash = reduce(hash); } RainbowTable[i][1] = hash; } double count = 0; boolean found = false; int j = 0; int hash; for(int i = 0; i < 10000; i++){ hash = hash(i); found = false; for(j = 0; j< 100; ++j){ if(hash == RainbowTable[j][1]){ hash = RainbowTable[j][0]; for(int k = 0; k < 100; ++k){ hash = hash(hash); if(i == hash){ found = true; count++; break; } } if(found) break; } } }

double percent = (count/10000)*100; System.out.println(percent); }

static int hash(int p){ double h = ((p + 25) % 10000) * ((p + 25) % 10000); h /= 100; h %= 10000; if(h > (int)h) h = (int)h; return (int)h; }

public static int reduce(int hash){ return hash; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago