Python Forum
How to update set of hash values until final hash value is found using the 5 hashes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to update set of hash values until final hash value is found using the 5 hashes
#1
so I am trying to create a python program that will give me a final hash that has been provided for me Final Hash: 42EE53E049F4E104BF81A517C5ED52BE2D94487A253FCF978CE783A3529794BC using the following 5 hash values: hash1: F7002A5259567B1F993E743D3128B6A97B153EACFC7BB914802DCFB43D23FA2E hash2: 6E2B86DC5982F533C3A896E66B97D377D09E7988B7E27E9BE5DDBA9F34C325FC hash3: 83AAB3327FFF40207AEB5919BD7FB06BAE953324FC71EE35816076CD6480334A hash4: 0B794C734A46D75BE2EEE543F714E8D7E2D41D0549D4D8E1167B77B63080DE83 hash5: EC40BD8242061EF401305485800CA5D63A9AB6DA659221A27C7BFAD3A9694E6C as well as an initial hash of: initial hash: E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855

Those 5 hashes and the initial value need to match up to the final hash.

I have tried to create a while loop, and I have tried to reorder the hash values for example instead of "1,2,3,4,5" I have tried "3,5,4,1,2" to see if I get the final value.

import hashlib

chain = hashlib.sha256()

#Hash 1
hash_1 = hashlib.sha256(b"This is my first hash")
hex_dig = hash_1.hexdigest().upper()
print("\nOld:",hex_dig)

#Hash 2
hash_2 = hashlib.sha256(b"This is my second hash")
hex_dig2 = hash_2.hexdigest().upper()
print("\nOld:",hex_dig2)

#Hash 3
hash_3 = hashlib.sha256(b"This is my third hash")
hex_dig3 = hash_3.hexdigest().upper()
print("\nOld:", chain.hexdigest().upper())

#Hash 4
hash_4 = hashlib.sha256(b"This is my forth hash")
hex_dig4 = hash_4.hexdigest().upper()
print("\nold:", chain.hexdigest().upper())

#Hash 5
hash_5 = hashlib.sha256(b"This is my fifth hash")
hex_dig5 = hash_5.hexdigest().upper()
print("\nOld:", chain.hexdigest().upper())

print("\nUpdated Chain\nAdding:\t",hash_3.hexdigest().upper())
chain.update(hash_3.digest())
print("New:\t",chain.hexdigest().upper())

print("\nUpdated Chain\nAdding:\t",hash_1.hexdigest().upper())
chain.update(hash_1.digest())
print("New:\t",chain.hexdigest().upper())

print("\nUpdated Chain\nAdding:\t",hash_2.hexdigest().upper())
chain.update(hash_2.digest())
print("New:\t",chain.hexdigest().upper())

print("\nUpdated Chain\nAdding:\t",hash_5.hexdigest().upper())
chain.update(hash_5.digest())
print("New:\t",chain.hexdigest().upper())

print("\nUpdated Chain\nAdding:\t",hash_4.hexdigest().upper())
chain.update(hash_4.digest())
print("New:\t",chain.hexdigest().upper())

print("\nFinal Chain:\n", chain.hexdigest().upper())

chain = hashlib.sha256()
print("\nInitial Chain:\n",chain.hexdigest().upper())
I expect the output to be Final Chain: 42EE53E049F4E104BF81A517C5ED52BE2D94487A253FCF978CE783A3529794BC

I've tried to rearrange the hex values but still cannot figure it out.
Reply
#2
May I ask why?
why not use existing algorithms and just increase byte width?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 5 3,695 Nov-23-2020, 05:15 PM
Last Post: cananb
Smile Final Projet - Credit Risk Rauchvant 3 2,374 Nov-18-2020, 03:21 PM
Last Post: Rauchvant
  Help needed, stuck at the final output extricate 0 1,513 Jun-20-2020, 05:35 AM
Last Post: extricate
  Final Project (Databases, GUI, and Classes) poochenthecreator 1 1,616 Apr-27-2020, 09:58 PM
Last Post: deanhystad
  Final Project Help hyg71886 6 3,885 Feb-07-2019, 01:30 AM
Last Post: micseydel
  Trouble with edX Python Final sarah_mb_sues 11 13,611 Jun-19-2018, 10:36 AM
Last Post: cryomick
  Final problem Truman 4 3,979 Jan-22-2018, 11:42 PM
Last Post: Truman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020