Unix timestamps, convert to hex, MD5 hash

Hi everyone

Does anyone know if Bubble can do any of the following natively (or at least a way of achieving it):

  • Get the current time as a Unix timestamp
  • Convert a string to hex
  • Create an MD5 hash

Any suggestions/ideas/experience most welcome :slight_smile:

1 Like

@emmanuel Please could you jump in on this?

as far as I know these function are not natively integrated in bubble.
But using a thrid party API, sure you’ll be able to.

Anymay, about Unix timestamp, true it would be useful to be able to encode it. And to decode Unix timestamp date with the API Connector especially.

1 Like

We don’t support this.

I also need an MD5 to get an authtoken for the skimlinks API https://api-reports.skimlinks.com/doc/#api_authentication

Authentication
In order to generate the authentication token for this API, use the following method (in PHP format ‘.’ is string concatenation, not multiplication):
Request
md5( TIMESTAMP . PRIVATE_API_KEY )

Response
md5( RESPONSE TIMESTAMP . STATUS CODE [200 etc.] . PRIVATE_API_KEY )

Anyone know what a good workaround would be for this?

In the end I created a quick PHP script for all the logic I needed including creating the MD5 hash etc and returned the result. I invoked the script and captured the result via the API plugin.

According to the release notes: https://bubble.io/release_notes

12/19/16 Added ability to get the MD5 hash of a text (pick ‘formatted as…’) after a text in the expression builder.

Experimenting with a fixed string plus current date/time:

4 Likes

Amazing! Thanks Mishav and Bubble. I am a lifetime user. I love it

2 Likes

How can you format a combination of information as an MD5 hash though?

When the combination has static text at the end it won’t allow me to ‘format as…’

image

Ran into this myself without finding a solution, but there must be a way to concatenate static strings with dynamic values and have the entire result put through a hash.

Hopefully ideas emerge!

Cant you just setup the string as a custom state a step before this one? That way you should be able to have this step be Index’s custom state:formatted as MD5.

In my case, this is needed in an api endpoint.

you could create a thing instead of a state.

1 Like

Of course, transient things in the db…I use those elsewhere and didn’t here. Thanks @jarrad

I know its not the most ideal method, usually when these types of things pop up for me I try and find a couple of uses to justify it to myself, like create the temp record first up, dont delete it at the end - then is duplicate api calls come through you have a record of a thing with a modified or created date to ref for rate limiting and what not.

That’s the silly thing, I am already creating a thing that is part log, and part action item, I just need to add a field to store this hash. So simple, but I made it complicated. I let my need for efficiency get in the way of effectiveness!

I hear you, I think we all find ourselves in that bubble at some point. another thing you could do (this is good for security measures also) is,

image

in your case @JustinC you needed something dynamic at the end - that last statement even if was unstable as in unknown to be true or false you just fill both yes and no with your MD5 hash, but it also makes for a great flipflop for security measures.

2 Likes

old threat but hoepfully somebody can still help me, i need to make a md5 hash of two stored variables, but i dont know how to combine them into one.

per example i have stored two values for a username and a password,
For the md5 has i need that as a string: username:password and then format as md5 hash.

But i dont know how to put the two values in that appereance box so that it becomes a single string