Abstract


Use Cases


  • Store secrete data in plaintext in the hash form (e.g Password)

Cons


Code Examples


Nodejs

const { createHash } = require('crypto')
 
function hash(input) {
  return createHash('sha256').update(input).digest("hex")
}
 
let password = 'password123'
console.log(hash(password));

Terminologies


MD5 (Message Digest)

  • A Hashing Algorithm that can be broken

SHA256 (Secure Hash Algorithm)

  • A Hashing Algorithm that produces a fix length of Digest that is 256-bits
# Output is hex encoded
shasum -a 256 <FILE_NAME>

Digest