Approach for signing message with HMAC (any recommendation for third party node?)


I have a Python script that I would like to integrate into Node-RED. Essentially, it signs a message with HMAC/SHA256.

So far, I've attempted to implement Crypto-JS to create a function in Node-RED. However, this approach isn't very flexible if I want to share the flow with others and also I'havent succeed :frowning:

Perhaps someone has created a similar example using a third-party flow and can assist or guide me through the process.

def mymessagesigned(mysecret, message, randomh):
    random_header_bytes = randomh.encode('utf-8')
    shared_secret_bytes = mysecret.encode('utf-8')
    signature =, digestmod=hashlib.sha256)
    return signature.hexdigest()

thank you

Why not? You can simply add crypto to a function nodes settings tab. The flow will be exportable and importable by anyone who you share it with.

Have you tried the existing contrib nodes? Library - Node-RED

THX for the info

I only read the "functionglobacontext" but didn't read further

With the settings tab it`s easy :slight_smile: thx

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.