14 lines
300 B
JavaScript
14 lines
300 B
JavaScript
const crypto = require("crypto")
|
|
|
|
function generateRandomHash(length = 32) {
|
|
// Generate random bytes
|
|
const randomBytes = crypto.randomBytes(length)
|
|
|
|
// Convert bytes to hexadecimal representation
|
|
const hash = randomBytes.toString("hex")
|
|
|
|
return hash
|
|
}
|
|
|
|
module.exports = generateRandomHash
|