0

I am working on a Electron/NodeJS application where i have a requirement wherein I have to create hashvalue which consist of all columns of a table.

I have done hasing for single password field like below and i don't have any experience how multiple columns hashing will work? Also if any column value changed on the sqlserver table, the hash should get invalidated. How can we do this?

Single Column Bcrypt Example

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
JSBeginner
  • 41
  • 2
  • 12
  • Why would you need to do this at all? What is the threat that is perceived who told you this requirement? If integrity is the goal then a "simple" hash function such as SHA-256 would suffice. Also, bcrypt has a limit on the input, so it may be impossible to "hash" multiple columns. – Artjom B. Oct 08 '20 at 18:28
  • @ArtjomB. Thank you for the advice. I don't know bcrypt will not accept a long columns of input. Do we have any npm package or library will help me to achieve the SHA-256 encryption? – JSBeginner Oct 08 '20 at 19:42
  • Before implementing anything understand the requirement and why it is there to begin with. This seems fishy to me. Anyway, node.js' crypto module provides anything that you need for hashing. – Artjom B. Oct 08 '20 at 20:34
  • @ArtjomB. Thank you. I tried with crypto and got the below error. Kindly help https://stackoverflow.com/questions/64270681/uncaught-typeerror-crypto-randombytes-is-not-a-function – JSBeginner Oct 08 '20 at 21:13

0 Answers0