How to use the sha256 function from node-forge

Find comprehensive JavaScript node-forge.sha256 code examples handpicked from public code repositorys.

39
40
41
42
43
44
45
46
47
48
  method,
  url,
  postdata,
  signingDate
)
const digest = forge.sha256
  .create()
  .update(sigData)
  .digest()
  .getBytes()
fork icon2
star icon26
watch icon2

2
3
4
5
6
7
8
9
10
/**
 * @param text [String]
 * @return hash [String] e.g. 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
 */
module.exports = function sha256(text) {
  var md = forge.sha256.create();
  md.update(text, 'utf8');
  return md.digest().toHex();
};
fork icon2
star icon6
watch icon1

4
5
6
7
8
9
10
11
12
13
const F = {
  hash(data: any){
    return js_sha256(data);
  },
  sha256(data: any){
    const tmp = forge.sha256.create();

    tmp.update(data);

    return tmp.digest().toHex();
fork icon0
star icon0
watch icon2