Question: Cracking the Code Aja and Emily have decided to quit their jobs as TAs and become l 3 3 t h 4 x 0 rz
Cracking the Code
Aja and Emily have decided to quit their jobs as TAs and become lt hxrz
But it turns out, hacking is mostly just brute force trial and error. They have guesses at what the password hashing function is but need to confirm it
Heres where you come in They need you to verify if their password cracker is w Cracking the Code
Aja and Emily have decided to quit their jobs as TAs and become lt hxrz
But it turns out, hacking is mostly just brute force trial and error. They have guesses at what the password hashing function is but need to confirm it
Heres where you come in They need you to verify if their password cracker is working. Dont worry, you wont need to know anything about cryptography. In fact, the final password cracking algorithm will be hidden from you.
You will be given a function that can compare two hashed passwords and returns true if they are the same unhashed password, and false if they are not.
Using this function, we want to determine if there are popular passwords in a list because those accounts likely share overused, simple credentials and are easily exploited.
Your job is to take a list of unsorted passwords, and determine if more than half are the same password. For example, let A B and C be unhashed passwords.
AAAAwouldresultin
A A B A would result in
A B C A would result in
AAABBBCCwouldresultin
You cannot compare passwords directly to each other because they are naively salted.
Good luck! Make Aja and Emily proud.
Develop an efficient divide & conquer algorithm to determine if more than half are the same password and if so retrieve the indices the popular password is stored in
Notes:
You must use the provided function to compare two passwords. Your output must be in ascending order.
Implement your algorithm for solving this problem in cscrackingthecode.py
Divide & Conquer Homework
In this assignment you will use the provided code template to implement solutions to each given problem. The solutions you submit must follow the guidelines provided in this document as well as any given in code.
Your solutions must implement a divide & conquer approach to each given problem. Both recursive and iterative implementations are accepted.
When using a known divide & conquer algorithm, only those covered in course material see Ed are allowed, and some are provided for you to use.
Restrictions
Template code is provided and must be used.
Your code must be compatible with Python
The provided container classes and their public methods are the only allowed means for retrieving, storing, and modifying data for solving each given problem.
Use of builtin functions eg map, zip, sorted and raw container types eg dict, set, list to do so is strictly prohibited.
Accessing private members and methods denoted by a prefix of the provided container classes is strictly prohibited.
Do not add, change, or remove imports in the code file used for submission.
Do not modify the function name, definition, or any of the provided utilities.
Testing
You can run your test cases by issuing the pythonm unittest command from the directory containing your solution files.
Generally Accepted Algorithm Practices
While using most builtin convenience features of Python is prohibited, the following examples are considered allowed, sensible use.
Using local variables to hold default, intermediate, or singleresult data.
Using public methods of any provided standard library types, such as Decimal.
Using raw containers to initialize given containers or facilitate use of approved builtin methods. Using abs to get the absolute value of a number or calculation.
Using len to determine the length of your inputs
Using match to simplify chained conditional checks.
Using max and min to perform a value comparison between or more items. May use key Using range as part of a loop construct.
Using round to round values, if a given problem calls for it
Implementation file:
cscrackingthecode.py
from typing import Callable
import algo
from util.mutablesequence import MutableSequence
from util.sequence import Sequence
globalpasswordlist None
globalcrackingfunction None
def CrackingCode
passwordlist: Sequenceint
crackingfunction: CallableSequenceint int, int bool
MutableSequenceint:
# Using globals here allow you to call comparepasswords from anywhere without having to pass the list and function around.
# You do not need to use this if you would rather use local scope only.
global globalpasswordlist, globalcrackingfunction
globalpasswordlist passwordlist
globalcrackingfunction crackingfunction
pass
def comparepasswordsa: int, b: int bool:
return globalcrackingfunctionglobalpasswordlist, a b
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
