The CreatorCon Call for Content is officially open! Get started here.

how to decode MD5 encrypted string?

Sumit35
Tera Contributor

how to decode MD5 encrypted string?

 

I have used below code to encrypt a string.

var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getMD5Base64(inputString));

Output:
SKdikyauk31LyQYS9KJ/gQ==


I want to get back the original string.

Please suggest the decode function for MD5 code.

Regards,
Sumit Jumale
7 REPLIES 7

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

You should store the encrypted password in the database, when you compare the stored password string with the value in send via the rest API

 

Without the details and API stuff

this is the pseudocode how to check

if (digest.getMD5Base64(inputString) == "SKdikyauk31LyQYS9KJ/gQ=="){
  //password correct
} 

 

I do not have bandwith to give full code example, hope this gets you started, and you can mark the answer as correct.

Thanks.

We are using get method in REST outbound.

When send outbound message from ServiceNow to other tool, that time we need to user MD5.

so in this case , who should store the password in encrypted format. ServiceNow or Other tool?

if it needs to be stored in servicenow, then where are we using that password ?

 

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Based on the info you provide, the password at the "other" side is stored as MD5, you should just send the password as MD5 encoded. But refer to that API documentation, or get in contact with the admin of that API.