{"version":3,"file":"crypto-utils.mjs","names":[],"sources":["../src/crypto-utils.ts"],"sourcesContent":["import type { Hash } from 'node:crypto';\nimport { createHash, randomBytes } from 'node:crypto';\n\nexport const defaultTarballHashAlgorithm = 'sha1';\n\n// @deprecated use @verdaccio/core\nexport function createTarballHash(): Hash {\n  return createHash(defaultTarballHashAlgorithm);\n}\n\n/**\n * Express doesn't do ETAGS with requests <= 1024b\n * we use md5 here, it works well on 1k+ bytes, but sucks with fewer data\n * could improve performance using crc32 after benchmarks.\n * @param {Object} data\n * @return {String}\n * @deprecated use @verdaccio/core\n */\nexport function stringToMD5(data: Buffer | string): string {\n  return createHash('md5').update(data).digest('hex');\n}\n\n// @deprecated use @verdaccio/core\nexport function generateRandomHexString(length = 8): string {\n  return randomBytes(length).toString('hex');\n}\n"],"mappings":";;AAGA,IAAa,8BAA8B;AAG3C,SAAgB,oBAA0B;CACxC,OAAO,WAAW,2BAA2B;AAC/C;;;;;;;;;AAUA,SAAgB,YAAY,MAA+B;CACzD,OAAO,WAAW,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK;AACpD;AAGA,SAAgB,wBAAwB,SAAS,GAAW;CAC1D,OAAO,YAAY,MAAM,CAAC,CAAC,SAAS,KAAK;AAC3C"}