UNPKG

e2ed

Version:

E2E testing framework over Playwright

15 lines (14 loc) 465 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getHash = void 0; const node_crypto_1 = require("node:crypto"); const defaultLength = 10; /** * Get `sha1`-hash (in `base64url`) of text with specified length. */ const getHash = (data, length = defaultLength) => { const hash = (0, node_crypto_1.createHash)('sha1'); hash.update(data); return hash.digest('base64url').slice(0, length); }; exports.getHash = getHash;