随机生成的加密字符串库(crypto-random-string)

$ npm install crypto-random-string //安装命令

const cryptoRandomString = require('crypto-random-string');

cryptoRandomString({length: 10});
//=> '2cf05d94db'

cryptoRandomString({length: 10, type: 'base64'});
//=> 'YMiMbaQl6I'

cryptoRandomString({length: 10, type: 'url-safe'});
//=> 'YN-tqc8pOw'

cryptoRandomString({length: 10, characters: '1234567890'});
//=> '1791935639'
展开
评论