0

I am trying to find information about this JavaScript/node.js function:

HMACSHA256()

Its mentioned e.g. here:

It's mentioned in other places too.

Neither node.js nor any browser JavaScript provides any function with that name.

So what is it? Is it pseudo code or is it a dummy function or simply a mistake everybody copies and pastes?

LongHike
  • 3,362
  • 3
  • 31
  • 59
  • It appears to be (have been?) a function provided by the CryptoJS library, according to [How to get digest representation of CryptoJS.HmacSHA256 in JS](https://stackoverflow.com/q/29432506/215552)... – Heretic Monkey Mar 07 '22 at 14:56

2 Answers2

1

You need a plugin named "crypto" It has "createHmac" function where you can give "sha256" as an argument.

https://nodejs.org/api/crypto.html#cryptocreatehmacalgorithm-key-options

aymcg31
  • 321
  • 1
  • 7
1

It is a standard algorithum.

The JWT documentation is providing psuedo-code (and also links off to JWT specific libraries that you should probably be using instead of writing your own implementation).

The blog you've found has code examples using Crypto-JS

Quentin
  • 857,932
  • 118
  • 1,152
  • 1,264
  • Thanks for clarifying. I was confused because everything else e.g. in the blog article is concrete JS/node code. – LongHike Mar 07 '22 at 15:04