Is there a js function/library which gives same output as sha256 in solidity? I am saving a hash in a mapping and can access it via cli (truffle console) and see what the hash is but I would like to send this same hash as an email. So on the frontend I need to get same hash and send it over via POST request to backend which then handles the email.
As pointed out in the comments,
soliditySHA3 mimics Solidity's
keccak256, functions, which are not related to SHA256.
web3.utils.soliditySHA3 does what you want: https://web3js.readthedocs.io/en/1.0/web3-utils.html#soliditysha3