node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import crypto from 'node:crypto';
import { isInteger } from 'lodash/fp';
/**
* Creates a hash of the given data with the specified string length as a string of hex characters
*
* @example
* createHash("myData", 5); // "03f85"
* createHash("myData", 2); // "03"
* createHash("myData", 1); // "0"
*
* @param data - The data to be hashed
* @param len - The length of the hash
* @returns The generated hash
* @throws Error if the length is not a positive integer
* @internal
*/ function createHash(data, len) {
if (!isInteger(len) || len <= 0) {
throw new Error(`createHash length must be a positive integer, received ${len}`);
}
const hash = crypto.createHash('shake256', {
outputLength: Math.ceil(len / 2)
}).update(data);
return hash.digest('hex').substring(0, len);
}
export { createHash };
//# sourceMappingURL=hash.mjs.map