Services Plugins FAQs

Base64, Hash & HMAC Encryptor

I have a requirement to obtain SHA256 of a string and encode the results in Base64 to validate messages. This is a requirement for a payment system provider to confirm the authenticity of their message.

They gave an example.

Original string:
2016050908070514550STANDARD CHART. BANK1000021441123Maxis3MYR2016-05-09T08:07:39.0000000+00:003598D772AGROBANK100033061N1230JQDSHALPKX

Using SHA256 on the string and encode the results in Base64, the result should be:
MTA1NzVkNmE2ZDU4ZmRkYmUxMDYxZDhkYmYyYjcwZDk3YmQ5MzEwMWMxZGVjMzhkYjk2Nzg0MzMzM2ZkMGFlMA==

Question:
a) Can Base64, Hash & HMAC Encryptor plug-in do this for me instead of writing my own JS plugin?

b) Is the result above correct? I can’t seem to obtain the results when I use SHA256 hash and then encoding it in Base64.

Hello, @kaventan

Let me try to offer insight.

a) The plugin offers a possibility to generate and encrypt strings using different methods. If I understood correctly the original string should be hashed using SHA256 method, and get a result. So yes it is possible using this plugin.

b) For encoding the hashed string you’ll need a secret key, so I can’t answer here if it is correct or not, since I do not know the key it was used to encrypt the string.

There is a demo page setup: https://plugindemo.bubbleapps.io/hash_hmac_encryptor
you could try it out.
Hope this helps.

Regards,
Dumitru.

Thanks Dumitru,

The thing I am looking for is not HMAC encryption which requires a secret key. I am looking for the 3rd example in the sample, namely Hash SHA-256 generation.

Having looked at the demo, the HASH SHA-256 Generator provides the hash. From the example, the hash is calculated from an input field.

In my application, I am getting the plaintext from my API endpoint (API workflow) when a POST is sent to the endpoint, rather than from an input form. Can your plugin do the hash generation from data obtained in an action?

I still need to convert the generated hash above to Base64. Any product or plugin that can do this for me?

Hi there, @kaventan

Yes it is possible to get data from an external API instead of input as it is demoed.

The string obtained after hashing is HEX as you saw already, we’ll need to check if it possible to add another type of output (B64) .

Regards,
Dumitru.

@kaventan

We updated the plugin and now it offers both HEX and B64 outputs and few more, for all Hashing methods besides MD5 which support only HEX.


See the demo: https://zeroqode-demo-17.bubbleapps.io/base64_hmac_hash?debug_mode=true
As I mentioned, the input could be an external API data.

Hope this helps you.

Regards,
Dumitru.