Hash, Salt and beyond

Hi all!

I need to generate a Hash with these procedure:

  1. The algorithm will be AES (that's not a problem).
  2. Method AES/CBC/PKCS5PADDING
  3. HASH in SHA-512

The first three points will be covered with a node.

But here comes the complex....additional the process will be the following:

  1. The Salt will be dinamic and random.
  2. Next to the Salt i need to apply a derivation process with a Hash 123WithHmac233
  3. The point 2 needs to be returned in HEX or Base64

I found it difficult to do it in node red, specially the SALT part.

Thanks a lot in advance.

Regards!

What library are you using to do this? And what have you tried?

I'd use a suitable library and a function node myself.

Hi.

I'cant use any library at all because i have to do it in a prod server, so no additional npm install can be done.

I know that the SALT is used in addition to the HASH and it can be placed in the first part or the last one of the HASH.

Tks!

Urm, you should never do crypto without a tried and trusted library. Rule number one: never do it yourself.

2 Likes

Yes that is right.
I know there is a well used library called 'cripto'.

Regards!

Can't you use the crypto library built in to nodejs?

On the setup tab of a function node, add an import named crypto then in the on message tab...

const salt = crypto.randomBytes(256).toString('base64');
//Do what you need to with salt then return the result...
msg.payload = result
return msg;

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