export const hashOf = (contents, { using }) => crypto.createHash(using).update(contents).digest('hex')
Generates a hexadecimal hash using named options.
Target style API. Preferred for new code.
Helpers
Source: helpers/generateHash.mjs
Target Style
Legacy Style
export const generateHash = (algorithm, contents) => hashOf(contents, { using: algorithm })
Generates a hexadecimal hash using the selected algorithm.
Legacy API. Kept for older code and not the preferred choice for new code.
export const generateHashSHA256 = (contents) => hashOf(contents, { using: 'sha256' })
Generates a SHA-256 hash.
Legacy API. Kept for older code and not the preferred choice for new code.
export const generateHashMD5 = (contents) => hashOf(contents, { using: 'md5' })
Generates an MD5 hash.
Legacy API. Kept for older code and not the preferred choice for new code.