谁能把这个函数从 python 翻译成 javascript?

Can anyone translate this function from python to javascript?

我在 python 中有一个脚本,它使用盐和 returns 证明 sha256.

我对 javascript 或任何图书馆都不是很了解。

import sys
from hashlib import sha256

def generate_proof(salt):
    secret_salt =  SECRET + salt
    hexadecimal = secret_salt.decode('hex')
    proof = sha256(hexadecimal).hexdigest()
    return proof

有人可以翻译或解释我如何将此方法翻译成 javascript 吗?

我认为我最大的问题是在 JS 中找到 sha256 等效库。

//  node.js
const filename = process.argv[2];
const crypto = require('crypto');
const fs = require('fs');

const hash = crypto.createHash('sha256');

const input = fs.createReadStream(filename);
input.on('readable', () => {
  // Only one element is going to be produced by the
  // hash stream.
  const data = input.read();
  if (data)
    hash.update(data);
  else {
    console.log(`${hash.digest('hex')} ${filename}`);
  }
});