Expand my Community achievements bar.

SOLVED

Adobe Campaign: HMAC-SHA1 encryption algorithm mechanism in javascript

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 3

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

View solution in original post

3 Replies

Avatar

Level 2

Hi Sumit,

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

Thanks,

Sivaramakumar

Avatar

Level 4

var message=new MemoryBuffer();

message.fromString("saikat");

var key=new MemoryBuffer();

key.fromString("password");

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

Avatar

Correct answer by
Level 3

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