Anecdota

Laughter is the Best Medicine

crack (Python)


ZAMYLA CHAN: Let’s crack
it in Python this time. For this problem, we’ll want
to get the hashed password, and then with that hashed
password, crack it. The hashed password
is going to be passed in via the command line argument. So once we have that,
let’s get cracking. You may make the assumption
that the passwords are hashed with the crypt module, so import
that to access the crypt function, which takes in a word and a
salt. The fundamental principle to this is that hashing a word
will always return the same hash as long as we use the same hash function
and salt. So if we try a word and hash it, then if that hash matches
the hash that the user gave us, then we can assume that we
have found their password. Then, in order to make
those guesses, then we need to make a couple of assumptions. You may assume that these passwords
are no longer than four characters long and that they’re composed entirely
of alphabetical characters. So the crux of this problem is
to generate all of the plain text to be hashed, iterating over
every possible permutation of one to four letters. Now, remember that passwords
are case sensitive, so an uppercase A is going to be a
different password than a lowercase a. I might suggest using
strings of lengths 1, 2, 3, and 4, [? iteratively ?] updating
the indices of those strings, cycling through the alphabet,
uppercase and lowercase. And once you find a
string that, once hashed, matches the hash that the user gave
you, you’ve cracked the problem. My name is Zamyla, and this was crack.

2 thoughts on “crack (Python)

Leave a Reply

Your email address will not be published. Required fields are marked *