Adobe Campaign: HMAC-SHA1 encryption algorithm mechanism in javascript | Adobe Higher Education
Skip to main content
Sumit_Saha
Level 2
August 19, 2016
Répondu

Adobe Campaign: HMAC-SHA1 encryption algorithm mechanism in javascript

Hi All,

I would require encryption of a field using HMAC-SHA1 encryption algorithm. It will take few parameters like key, cipherMode, data and generate a hex encrypted value in return. I need to encrypt a field value using HMAC-SHA1 mechanism inside JavaScript code.

Can you please help me with the process?

Happy Campaigning

Sumit

Ce sujet a été fermé aux réponses.
Meilleure réponse par Yassine_N

Hello,

Hope this will help you.

hmacStr

Calculates the MD5, SHA-1 or SHA-256 hash of a string of characters. The string is automatically encoded in UTF-8 before the calculation.

hmacStr (string [, key ] [, algo ])

Parameters

string

The string in which the hash is to be calculated.

key

Key, in the form of a string of characters. It is automatically converted into UTF-8. If the key is missing, the server will use a key that depends on the instance and is only valid on this instance.

algo

Type of hash to use. Possible values are "MD5", "SHA1" or "SHA256". Case is ignored, values can therefore be entered in lower case or upper case. The value "SHA1" is selected by default, if no parameter is specified.

You can find more info in here : ColdFusion Help | Encrypt

3 commentaires

Level 2
March 14, 2017

Hi Sumit,

Did you get any process for the above requested requirement. to encrypt and external teams to decrypt the values.

Thanks,

Sivaramakumar

saikatk2447661
Level 4
September 16, 2018

var message=new MemoryBuffer();

message.fromString("saikat");

var key=new MemoryBuffer();

key.fromString("password");

logInfo(message.hmac(key,"SHA1"))

Yassine_NRéponse
Level 2
September 27, 2019

Hello,

Hope this will help you.

hmacStr

Calculates the MD5, SHA-1 or SHA-256 hash of a string of characters. The string is automatically encoded in UTF-8 before the calculation.

hmacStr (string [, key ] [, algo ])

Parameters

string

The string in which the hash is to be calculated.

key

Key, in the form of a string of characters. It is automatically converted into UTF-8. If the key is missing, the server will use a key that depends on the instance and is only valid on this instance.

algo

Type of hash to use. Possible values are "MD5", "SHA1" or "SHA256". Case is ignored, values can therefore be entered in lower case or upper case. The value "SHA1" is selected by default, if no parameter is specified.

You can find more info in here : ColdFusion Help | Encrypt