Urara-Blog/node_modules/.pnpm-store/v3/files/20/7bc9a87ce9ab2ae37d3bfd7e4504e37a77b79b52b7a82ef8d2f5ebb5cb3185a61e87f636c8ef41e5b24d3ee379e775a6eb1ded461363595b1b402c01d0d5bb
2022-08-14 01:14:53 +08:00

10 lines
253 B
Text

'use strict';
const crypto = require('crypto');
module.exports = length => {
if (!Number.isFinite(length)) {
throw new TypeError('Expected a finite number');
}
return crypto.randomBytes(Math.ceil(length / 2)).toString('hex').slice(0, length);
};