Hashify API returns different hash | -g option?

I’m trying to get a WebAPI block working for Hashify.net. This block should hash a joined Private API key from our MAM and the rest of the query that’ll be sent to this MAM in a second Web API block.

I run the following curl command:

curl --location -g ‘https://api.hashify.net/hash/sha256/hex?value=[longstringoftext]

Which gives the following reply:

{“Digest”:“46ed328f8db206885b05cc0-… and so on”,“DigestEnc”:“hex”,“Type”:“SHA256”,“Key”:“”}%

However, when I run the same [longstringoftext] through a WebAPI GET block in thunkable, I get a completely different hash reply.

My curl command includes the --location and -g parameters. -g has to do with treating text a certain way, so I’m suspecting the issue might be that the Thunkable block isn’t passing that parameter. Where in the WebAPI block should I supply this -g parameter?

From their docs, it looks like there is a way to change the language to Javascript - Fetch. I would recommend using this language with our WebAPI blocks.

@brianl Thanks for the tip, that sounds very interesting!

Can you elaborate on what you mean by using Javascript Fetch with the WebAPI blocks? I can’t find anything in the Thunkable docs about using actual code in WebAPI blocks, so I’m unsure on how to follow up on this.

With our Web API blocks, you will have to take the code and translate which parts will go into which area of the Web API blocks.

For example where its says “fetch(‘api.hashify.net/hash/md4/hex?value=helloWorld’, requestOptions)”, the URL would would go into the URL section of the Web API section.

Happy to report that I’ve managed to make Hashify work with the WebAPI blocks!
Turns out, the trick was to use https://hashify.net/hash/sha256/hex as the URL and then supply the string to be hashed as a Query Parameter. This parameter should have the name ‘value’ and the value being whatever string of text you need to hash.

Here’s what the block looks like for this test. You can see the results from the Hashify block is assigned to a variable, which is then used again as the ‘sign’ parameter of another WebAPI block. That WebAPI block then uses this hash to sign the API command to our Resourcespace MAM.

So far I’ve managed to succesfully change a value of one of our resources. Next challenge will be to upload media from the Thunkable app to Resourcespace :slight_smile:

2 Likes