1

I need to decrypt MD5 hashes in node.js (using crypto bultin module) Didnt tried to do anything beacuse even didnt found anything about decryption MD5, not cipher.

var hash = crypto.createHash("md5").update("example").digest("hex");
//how can i decrypt MD5 hash?
Cilian
  • 11
  • 1
  • 1
  • 2
  • 3
    MD5 does not decrypt. MD5 is used to hide source and compare with destination encrypted too. Like md5(123456) = E10ADC3949BA59ABBE56E057F20F883E, then you transmit md5 from client to server to hide password from sniffers, and in server you get password 123456, apply md5 checksum = E10ADC3949BA59ABBE56E057F20F883E and compare with received Md5 if matches. – Leonardo Getulio Sep 05 '19 at 22:33
  • okay, edited before i said – Cilian Sep 05 '19 at 22:37
  • Thanks for answer, i thought its possible to decrypt MD5 – Cilian Sep 05 '19 at 22:39
  • Once a string/file is encrypted as md5 you cannot decrypt. It's only a hash/calc from a source data. If you need to encrypt and decrypt data, try RSA or another with salt. – Leonardo Getulio Sep 05 '19 at 22:39
  • @cillian I suggest you google "what is the difference between an encryption algorithm and a hashing algorithm" – Luke Joshua Park Sep 06 '19 at 04:47
  • @Cilian Nope, you can only hash *not encrypt* nor decrypt; a hash is a *one-way* function. You can sometimes brute force all possible messages in a domain to try and find the same hash though. – Maarten Bodewes Sep 06 '19 at 10:53

1 Answers1

5

Simple answer: You can't. Cryptographic hash functions are one-way functions. Some people call them "one-way encryption" but hash functions like MD5 aren't encryption at all. They're cryptographic, but not all cryptography is encryption.

See more here.

Scott Arciszewski
  • 33,610
  • 16
  • 89
  • 206