Base64, Hash & HMAC Encryptor - New plugin from Zeroqode

hey Bubblers!
we have published a new plugin - Hash & HMAC Encryptor

Hash & HMAC generator for encrypting text strings using one of the following encryption methods: SHA-1,SHA-224,SHA3-224,SHA-256,SHA3-256,SHA-384,SHA3-384,SHA-512,SHA3-512,SHAKE128,SHAKE256
here is the plugin page:

here is the demo page:

Levon Terteryan
Founder @ Zeroqode & Bubblewits

zeroqode-for-web-160x120

Bubble Templates
Bubble Plugins
Bubble Courses
Convert Web to iOS & Android
No-code Development Services

We’ve just added Base64 encoding/decoding to this plugin

Levon Terteryan
Founder @ Zeroqode & Bubblewits

zeroqode-for-web-160x120

Bubble Templates
Bubble Plugins
Bubble Courses
Convert Web to iOS & Android
No-code Development Services

This is a great plugin, but I think I may be using it wrong. When I calculate something with the plugin, it creates an incorrect hash.

When I put the same data into http://www.timestampgenerator.com/tools/sha1-generator/ it works.

Thanks for your help.

Hey Scott,
we just checked and it seems to work fine for us, we get the same hash through the plugin as on the link you shared.

Levon Terteryan
Founder @ Zeroqode & Bubblewits

let’s stay in touch on twitter!

zeroqode-for-web-160x120

Bubble Templates
Bubble Plugins
Bubble Courses
Convert Web to iOS & Android
No-code Development Services

Hey @levon

Can this plugin also decode a HMAC-SHA256 using a secret or only encrypt it?

It can only encrypt it.

Levon Terteryan
Founder @ Zeroqode & Bubblewits

let’s stay in touch on twitter!

zeroqode-for-web-160x120

Bubble Templates
Bubble Plugins
Bubble Courses
Convert Web to iOS & Android
No-code Development Services

Hello.

Can this plugin be used to communicate with Amazon AWS?

thanks.

@levon Its worth pointing out that this shouldn’t be used with a server secret, as it’d get exposed to users via the browser.

2 Likes

@miguel

but

@mishav is right, we wouldn’t recommend to use this for API tokens as it indeed can be exposed in the browser (although it’s very difficult to find)

1 Like

Hi @levon

I need HMAC-MD5 encryptor.

Will you add this feature in future times? Or am I the one who can’t see it?

Thanks

Unfortunately this is not supported right now, and might be a long time before we implement it due to a large backlog of things in progress
sorry about that

Thank you

@eren You may find this useful:

1 Like

@eren, if you need to run something server side, without user interation, you could try webtask.io combined with an API setup in Bubble. This is some code I’ve used in the past to pass details to webtask.io to create the encryption and then pass back to Bubble for use. Depending on your needs it may need slight modifications.

/**
* @param context {WebtaskContext}
*/
module.exports = function(context, req, res) {
  var crypto = require('crypto');
  var secret = context.data.secret;
  var timestamp = context.data.timestamp;
  var requestPath = context.data.requestPath;
  var method = context.data.method;
  
  var what = timestamp + method + requestPath;
  var key = Buffer(secret, 'base64');
  var hmac = crypto.createHmac('sha256', key);
  var message = hmac.update(what).digest('base64');
  var getMessageObj = {
    // having to combine the timestamp and message. I'm using regex find/replace in Bubble to split these into the two fields
    "result": message
  };
  
  
  res.writeHead(200, {'Content-Type' : 'application/json'});
  switch(req.method){
    case 'GET':
      res.end(JSON.stringify(getMessageObj));
      break;
      case 'POST':
        res.end(JSON.stringify(postMessageObj));
      break;
  }
  res.end(message);
};

Here’s an example for MD5.

/**
 * @param context {WebtaskContext}
 */
module.exports = function(context, req, res) {
    var crypto = require('crypto');

    var nonce = Math.floor(new Date().getTime() / 1000);
    var key = context.data.key;
    var secret = context.data.secret;
    var api_method = context.data.apimethod;
    var uri = 'https://www.cryptopia.co.nz/api/' + api_method;
    var currency = context.data.currency;
    //Post Paramaters
    var postParams = {
        "Currency": currency,
    };
    // MD5 Post Paramaters
    var md5 = crypto.createHash('md5').update(JSON.stringify(postParams)).digest();
    //Base64 encode MD5 Post Parameters
    var requestContentBase64String = md5.toString('base64');

    var signature = key + "POST" + encodeURIComponent(uri).toLowerCase() + nonce + requestContentBase64String;
    var hmacsignature = crypto.createHmac('sha256', new Buffer(secret, "base64")).update(signature).digest().toString('base64');
    var amx = "amx " + key + ":" + hmacsignature + ":" + nonce;

    var postMessageObj = {
        "result": amx
    };

    res.writeHead(200, {
        'Content-Type': 'application/json'
    });
    res.end(JSON.stringify(postMessageObj));
};
4 Likes

Thanks a lot @gaurav @Kfawcett

Is there any documentation or videos to show us how to use this plugin? I have subscribed already since i don’t know what to do. Once I can resolve my issue of trying to get wizIQ API to run inside of Bubble. If you know how I can do this then please inform me

Thanks in advance

here is a demo page that you can use as an example:
https://bubble.io/page?type=page&name=hash_hmac_encryptor&id=plugindemo&tab=tabs-1

Can this plugin work with API connector to encrypt key value.
This is what they need:
“jsSHA Javascript library, but any SHA library will work as long as it support SHA-1, HMAC and BASE64 encoded output”

Hello, @sat_miha, thanks for reaching out.

Can you please provide more details on the feature you’re asking about? The detailed description of it will help us to investigate, if the Base64, Hash & HMAC Encryptor plugin can have such functionality.

Regards,
Zeroqode Team

I’m trying to connect dux-soup through API, they ask to encrypt key every time query is sending.
Standart Api connecter doesn’t allow me to do it, so I’m searching for sollutions.