Reputation: 1039
Kindly ignore my understanding with following code as I've no or limited knowledge with JS. Could anyone help understanding as what's happening in the last bit of the code: digest('hex')
Code:
const payloadHash = crypto
.createHmac('sha1', secret)
.update(request.body)
.digest('hex');
As far as I could understand, it's creating a HMAC with SHA1 algorithm, but not sure of digest('hex')
. What would be C# equivalent of the same or how to replicate the same in C#. I'd want to achieve the same in C#.
Upvotes: 0
Views: 459
Reputation:
This is the C#
equivalent. See ComputeHash and hmac.digest for more information.
HMACSHA1 hmac = new HMACSHA1(secret);
byte[] payloadHash = hmac.ComputeHash(request.body);
Upvotes: 1