UNPKG

@abdellatif.dev/cryptjs

Version:

A JavaScript/TypeScript library that brings cryptographic functionality from Dart to the web

39 lines (38 loc) 847 B
"use strict"; export const shaType = { sha256: { name: "sha256", code: "5" }, sha512: { name: "sha512", code: "6" } }; export default class Sha { /** @type {import("./types").ShaType} */ type; /** @type {string} */ hash; /** @type {string} */ salt; /** * @description Creates an instance of the Sha class. * @param {import("./types").ShaType} algorithm type of algorithm * @param {string} salt The hash value. * @param {string} hash The salt value. */ constructor(algorithm, salt, hash) { this.type = algorithm; this.salt = salt; this.hash = hash; } /** * Method to get the salted hash. * @returns {import("./types").SaltedHash} The salted hash value. */ toString() { return `$${this.type.code}$${this.salt}$${this.hash}`; } } //# sourceMappingURL=sha.js.map