nodejs crypto.createhash('sha256') produces different hash for the same response object

345 Views Asked by At

I am getting a response from a server every minute and creating a hash with it. After each fetch from server the hash created is different although they are identical when checked in jsondiff.

 let etagh = createHash('sha256').update(JSON.stringify(response.json.data)).digest('hex').toString()
 reply.header('etag',etagh)

The response.json.data is always the same but the etagh changes after every fetch call. After every fetch call, the response.json value is updated.

0

There are 0 best solutions below