0

I am trying to read lines from a file which contains hashed data. The data was hash with the following code:

encoder = hashlib.sha224()
encoder.update(string)
file.write(encoder.hexdigest())

how do I rehash the data?

3
  • Rehash? That is an one-way function, or you want to crack it? Commented Oct 10, 2011 at 10:22
  • 4
    If by rehash you mean reconstruct the data from the hash - that's not possible. This is the whole point of secure hash-functions. Commented Oct 10, 2011 at 10:23
  • so how can I hash string to key and do the other way (key to string)? I can change the way this file is written Commented Oct 10, 2011 at 10:41

1 Answer 1

1

As already said, you can't do that, and that's the actual idea behind hashing. I think what you are really looking for is encryption.

When the data is encrypted, nobody can read it. Only when you know how to decrypt it, you can read it again. There are many different ways of encryption, such as symmetric and asymmetric, just read about it, or supply more information about what you are really trying to do so we can tell you what encryption you should use.

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.