0

I'm try decrypt one string in format MD5 but I have not been able, this the code:

String e = 'test@testcom';
Blob b = Crypto.generateDigest('MD5', Blob.valueOf(e));
System.debug(EncodingUtil.base64Encode(b));
String result = EncodingUtil.convertToHex(b);
System.debug(result);
Blob b2 = EncodingUtil.convertFromHex(result);
String e2 = EncodingUtil.base64Encode(b2);
  • 5
  • When you say "decrypt one string in format MD5" are you really trying to decrypt a provided hash, or find the hash generated by Crypto.generateDigest? Based on the code it seems like the latter. – Matthew Poer Aug 22 '18 at 16:08
7

By it's very nature you cannot decrypt MD5. It's a one way hash algorithm. There are some sites that claim to decrypt certain phrases but all they do is store known phrases to return them.

Reference

Md5 (Message Digest 5) is a cryptographic function that allows you to make a 128-bits (32 caracters) "hash" from any string taken as input, no matter the length (up to 2^64 bits). This function is irreversible, you can't obtain the plaintext only from the hash. The only way to decrypt your hash is to compare it with a database using our online decrypter.

  • 1
    It's not encryption. It's a hash algorithm. – Adrian Larson Mar 22 '17 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.