Courses
Backend Path - Golang
Backend Path - TypeScript
Training
Pricing
Gifts
Redeem
Teams
Community
Youtube
Podcast
Lore
Blog
Leaderboard
Sign In
  • Courses
    • Backend Path - Golang
    • Backend Path - TypeScript
  • Training
  • Pricing
    • Gifts
    • Redeem
    • Teams
  • Community
    • Youtube
    • Podcast
    • Lore
    • Blog
  • Leaderboard

Boot.dev Blog - Pg. 16

  • Secure Random Numbers in Node.js

    Jul 03, 2019 by Lane Wagner

    Quick answer: use crypto.randomBytes() for cryptographically secure randomness in Node.js. const { randomBytes } = await import("node:crypto"); const buf = randomBytes(256); console.log(`${buf.length} bytes of random data: ${buf.toString("hex")}`); crypto.randomBytes() is a cryptographically secure random number generator based on openssl. Depending on the operating system of the user, randomBytes will use /dev/urandom (Unix) or CryptoGenRandom (Windows).

  • Previous
Categories - Contact - Playground - About
boot.dev
Sitemap RSS FAQ TOS Privacy
© Boot.dev 2024