pad.libre-service.eu-etherpad/src/node/utils/randomstring.js

14 lines
323 B
JavaScript
Raw Normal View History

2012-01-28 13:24:58 +01:00
/**
* Generates a random String with the given length. Is needed to generate the Author, Group, readonly, session Ids
*/
var crypto = require('crypto');
2012-01-28 13:24:58 +01:00
var randomString = function randomString(len)
{
crypto.randomBytes(len, function(ex, buf) {
return buf.toString('hex');
});
2012-01-28 13:24:58 +01:00
};
module.exports = randomString;