What does hash.js 's update ('abc') and digest (' hex') mean respectively?

github: https://github.com/indutny/ha.

how to use hash.js:

var hash = require("hash.js")
hash.sha256().update("abc").digest("hex")

question:
what does update ("abc") and digest (" hex") mean respectively?

Dec.09,2021

abc is the string you want to deal with, and hex is the result output format

var hash = require('hash.js')
var res = hash.sha256().update('abc').digest('hex')
console.log(res);

res = hash.sha256().update('123').digest('hex')
console.log(res);

res = hash.sha256().update('123').digest('bin')
console.log(res);

will output

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3
[ 166,
  101,
  164,
  89,
  32,
  66,
  47,
  157,
  65,
  126,
  72,
  103,
  239,
  220,
  79,
  184,
  160,
  74,
  31,
  63,
  255,
  31,
  160,
  126,
  153,
  142,
  134,
  247,
  247,
  162,
  122,
  227 ]
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e80605-5b8ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e80605-5b8ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?