Answers for "nodejs generate random string crypto"

22

how to generate random string in node js

var crypto = require("crypto");
var id = crypto.randomBytes(20).toString('hex');

// "bb5dc8842ca31d4603d6aa11448d1654"
Posted by: Guest on July-16-2020
1

random string generator node js

function makeid(length) {
    var result           = [];
    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    var charactersLength = characters.length;
    for ( var i = 0; i < length; i++ ) {
      result.push(characters.charAt(Math.floor(Math.random() * 
 charactersLength)));
   }
   return result.join('');
}

console.log(makeid(5));
Posted by: Guest on April-19-2021
1

js crpyto generate safe token

const crypto = require('crypto');

const token = crypto.randomBytes(48).toString('hex');
Posted by: Guest on October-11-2020
0

randomstring npm

npm install randomstring
Posted by: Guest on August-12-2020

Code answers related to "nodejs generate random string crypto"

Code answers related to "Javascript"

Browse Popular Code Answers by Language