D
D
Danil Sysoev2016-09-07 02:06:31
PHP
Danil Sysoev, 2016-09-07 02:06:31

How to decrypt a password knowing the salt and encryption method?

Hello friends. In general, there was such a question. There is a function that generates a password:

function GenPass ($p1, $p2) {
  return md5('соль'.md5('соль'.$p1.'соль').md5('соль'.$p2.'соль'));
}

But this password must be brought to its original form, since this password will be used for authorization on a third-party resource.
Tell me if this can be done at all, if not, what is the right thing to do in my situation.
Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2016-09-07
@YoungOldMan

no way: hashes are not decrypted. you can only stubbornly choose a password that will give the same hash.
if you need a password, then you need to store it explicitly encrypted, and not as a hash.

X
xmoonlight, 2016-09-07
@xmoonlight

How to decrypt a password knowing the salt and encryption method?
return md5('salt'.md5('salt'.$p1.'salt').md5('salt'.$p2.'salt'));
Perhaps you mean: "How to decrypt a password, knowing the salt and hashing method ?"
Answer: no way.
The only option is to capture the password when checking BEFORE it is hashed (to check with this hash according to the formula you provided) and, if it is correct, add an entry to the database with the ENCHANTED password next to it on the fly.

A
Alexander, 2016-09-07
@Deexter

Why do you need to decrypt? On another resource, check the credentials in the same way against the same database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question