How to MD5 hash a value, before using it in an API action?

Hello all!

How can I MD5 hash a value, a string in this case, before using it in an api-action?

The value is given from the database, in the form of a string. There is a challenge set by the other end, in this case in the form of a response to https://server/api?. The challenge is given in return after initial connection to the server in the form of a long string of numbers.

My response should be: MD5 ( MD5 (“secret”) + challenge) ,in order to authenticate.

How can I create these MD5 hashes from Wappler while setting up the API-action, so as to store them for use later on?

Thanks in advance!

I assume you are using the API Action step in your server action? For the values there you can use dynamic values so you can directly hash your string there.

That’s good to know, thank you for your reply!

But I get the value from the database, in the form of a string. Then what do I do to MD5 hash this string? I still don’t see how to MD5 this string in the API connector… I’m sorry.

Or should I MD5 hash this beforehand and put the hash in the dynamic picker from the API connector? Then my question is how to MD5 hash the string in the database…?

Better question: is there a way to MD5 hash values in Wappler, and where can I find this function?

Hi @Michel2

Yes, there is a formatter for MD5 (and SHA256, etc.) so you just apply that to any value and it will turn it into the hashed version. You can then compare it to what is stored in the database.

2 Likes

Thank you very much for your answer, that clarifies a lot!

I wish you a very good day!

2 Likes

I can still not find it… I have the value, I can select it to insert into the array, but I don’t see which formatter to use… There is no MD5-formatter. There is date-time, format number, default, etc, etc… But I can’t find MD5 or another hash.

Or at least, I don’t know where to find it… :wink:

Can you please post a screenshot showing what you mean here?

Of course… I can only show where I’m trying to change the value to an MD5 hash so far, because when I click the "magic pencil’ and I lose focus with using my screencapture window, then it doesn’t show anymore. But I’m trying through this ‘Magic Pencil’ and then select the value and then try to apply a formatter on ‘Value’. The value is from an inputtext form element.

But this is the front-end data picker.
The MD5 hashing is done on the server side, in Server Connect. When working with sensitive data, APIs requiring secret keys etc., this should never happen on the front-end and always on the server-side.

2 Likes

Ahhhhh!!! Thank you so much! Found it!

And thanks for the clarification; finding my way around all this new stuff…

2 Likes