MD5 encrypt in object script trigger

Posted by on 30-Oct-2015 10:11


Do you have an idea on how to encrypt a string to MD5 using Rollbase Object Script trigger?

I have tried many md5 JavaScript functions which work just fine when used in my web-browser directly (in console).

But when I use them in an object script, I get a different result.

For instance,

The string "hello" encrypted to md5 gives :


I have a JavaScript function which works just fine and encrypts "hello" to "5d41402abc4b2a76b9719d911017c592".

When I use this function in an object script trigger, it returns "fe53e8f02c0cea90abc7134fe75c7cda".

Why is that?

I don't know what to do, I have tried many different MD5 JavaScript functions, I always end up with a wrong result in my triggers, but with a good result when used in the web browser.

Please this is an important and almost urgent matter to us because we need to encrypt strings in md5 for one of our customers as soon as possible.

Kind regards,


All Replies

Posted by murali on 30-Oct-2015 15:08

Hi Romain, is it a custom function?

How do you make it available in the serverside ( Object Script ) ?

Can you share the function code pls?

Posted by on 02-Nov-2015 02:54


Thank you for your answer!

I have tried on Rollbase Hosted Cloud and it actually works fine.
It just doesn't work in our Rollbase Private Cloud Instance.

We use the following code (see attachments):

- In Rollbase Hosted Cloud (replace "console.log" with "rbv_api.println" to try it), and when directly computed by Web browser (Google Chrome), it prints : 5d41402abc4b2a76b9719d911017c592 (Which is correct)

- In our Rollbase Private Cloud, it prints : fe53e8f02c0cea90abc7134fe75c7cda (Which is incorrect)

Do you know if this is this due to an encoding issue?
We use UTF-8 in our Tomcat configuration.

Thank you,

Kind regards,


Posted by murali on 02-Nov-2015 11:50

Roman, is it a custom function?
How do you make it available in the serverside ( Object Script ) ?
Can you share the function code pls?

Posted by Thierry Ciot on 02-Nov-2015 11:50

Which version of Rollbase is that on?
Maybe depending on the version you are on, the JS library is old ?  just a guess.
Also, could you post a sample app xml file so that we can try it on our end.
Thanks. Thierry.

Posted by murali on 02-Nov-2015 12:54

Yes I too tried in my dev environment ( 4.0.3) and it works fine. I get ( 5d41402abc4b2a76b9719d911017c592 )

Like Thierry asked, which Rollbase / Java versions?

Posted by on 03-Nov-2015 03:13


Thank you for your help.

Actually, I just noticed that it works fine when doing a rbv_api.setFieldValue!

The error only occurs in the debug window (When testing the trigger, the "println"it prints the md5 hash as "fe53e8f02c0cea90abc7134fe75c7cda", but in the end it stores the value "5d41402abc4b2a76b9719d911017c592" in the field, which is the correct value.)

This is great news for us, because this means that it is in fact working, and that the error only occurs when "debugging the formula".

Still, it is a weird behaviour and we lost quite some time because of it.
You will find an app in attachements to try it out. When debuggin the formula, the "println" function prints "fe53e8f02c0cea90abc7134fe75c7cda" in our case (when having typed "hello" as string to encrypt).

We are using Java7, Tomcat7 and Rollbase (We hope to migrate to 4.0 as soon as possible).

Thank you very much for your help.

Kind regards,


Posted by murali on 03-Nov-2015 05:34

Glad that it works. It is weird; but since the issue is in 2.2.x & not on 3.2.x or 4.0.x, we'll not chase it.

This thread is closed