To generate random SHA1 hash to use as ID in Node.js, we use the crypto.randomBytes
method.
For instance, we write
const id = crypto.randomBytes(20).toString("hex");
to call randomBytes
to create a byte object with 20 bytes.
Then we call toString
on it with 'hex'
to convert it to a hex string.