2

I have a string which is a SHA256 hash, and I want to pass it to a Python script which will convert it to a SHA256 object. If I do this:

my_hashed_string = // my hashed string here
m = hashlib.SHA256()
m.update( my_hashed_string  )

it will just hash my hash. I don't want to hash twice...it's already been hashed. I just want python to parse my original hashed string as a hash object. How do I do this?

2
  • 1
    why would you want to do this? what is your goal? Commented Oct 1, 2011 at 20:26
  • I'm hashing a string on the client side then sending it via AJAX to a python script on the server. Commented Oct 1, 2011 at 20:29

1 Answer 1

4

Unfortunately the hash alone isn't enough info to reconstruct the hash object. The hash algorithm itself is temporal, depending on both internal structures and further input in order to generate hashes for subsequent input; the hash itself is only a small piece of the cross section of the algorithm's data, and cannot alone be used to generate hashes of additional data.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.