Skip to content

Instantly share code, notes, and snippets.

@fado
Last active April 20, 2017 06:45
Show Gist options
  • Save fado/01d96513a1b3713b8c0b88cf7f1c7a32 to your computer and use it in GitHub Desktop.
Save fado/01d96513a1b3713b8c0b88cf7f1c7a32 to your computer and use it in GitHub Desktop.
import hashlib
# abcd
hash1 = "D8022F2060AD6EFD297AB73DCC5355C9B214054B0D1776A136A669D26A7D3B14F73AA0D0EBFF19EE333368F0164B6419A96DA49E3E481753E7E96B716BDCCB6F"
his1 = "79996da6d0c5f30cc64b4745961d5fc7"
# defg
hash2 = "B9F2D23BAFEE03F8AF686E98CBB7CBC5C841C5A551754E80CA90D108A7993483A5DFE7BE693D446BE0D751265363B1EB83AE82CBBBA6136A99FF1A12C843CD90"
his2 = "5ff5eefbbb35296cb3a4633cc00962c6"
# hijk
hash3 = "159E656E014465149D67509452759E8F6646ECFB47D339B6403DEFEB68A6A2DB913E9B53A90F873C09D960E002FBD4A12749868BBBC91F39805C22965BF9F5CC"
his3 = "1dcf94ed1e9c590f22f2ffb986663e56"
# zoot
hash4 = "C9E689F24CB98ED92737AB33E2A664BF47C8C54C09D817E190244082B29F4D3CF477155A15884165CEA8D96B4C85B2E91FE0A854DD4A8FE895E9A84291CCFE67"
his4 = "479f797bc2c593bf2c4d8fc6581fe6e3"
ngrams = []
hisNgrams = []
for i in range(len(hash1)):
ngrams.append(hash1[i] + hash2[i] + hash3[i] + hash4[i])
for i in range(len(his1)):
hisNgrams.append(his1[i].upper() + his2[i].upper() + his3[i].upper() + his4[i].upper())
print(ngrams)
print(hisNgrams)
key = []
for hisNgram in hisNgrams:
key.append(ngrams.index(hisNgram))
print(key)
testHash = hashlib.sha512(b"abcd").hexdigest()
print(testHash)
testOutput = ""
for i in key:
testOutput = testOutput + testHash[i]
print(testOutput)
if testOutput == his1:
print("Test success.")
firstPass = "87017a3ffc7bdd5dc5d5c9c348ca21c5"
secondPass = "ff17891414f7d15aa4719689c44ea039"
thirdPass = "ff17891414f7d15aa4719689c44ea039"
fourthPass = "ff17891414f7d15aa4719689c44ea039"
count = 0
f = open("rockyou.txt", encoding="utf8")
while True:
pword = f.readline()
finalHash = ""
hash = hashlib.sha512(pword.encode("UTF-8")).hexdigest()
for i in key:
finalHash = finalHash + hash[i]
#print(pword + " | " + hash + " | " + finalHash)
if firstPass == finalHash:
print("First password is: " + pword)
if secondPass == finalHash:
print("Second password is: " + pword)
if thirdPass == finalHash:
print("Third password is: " + pword)
if fourthPass == finalHash:
print("Fourth password is: " + pword)
count = count + 1
if not pword: break
print(str(count) + " passwords tried.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment