What is the JavaScript/node.js function HMACSHA256()?

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?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 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

Method 2

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x