'use strict'; const crypto = require ('crypto'); /** * creates a sha256 hash * * @param {any} data input * @returns {string} hash */ function checksum (data) { const md = crypto.createHash ('sha256'); md.update (String (data)); return md.digest ('hex'); } /** * creates a sha512 hash * * @param {string} str string input * @param {string} salt salt * @returns {string} salt */ function hash_sha512 (str, salt) { const md = crypto.createHash ('sha512'); md.update (str); md.update (salt); return md.digest ('hex'); } module.exports = { hash_sha512, checksum };