13 lines
301 B
JavaScript
13 lines
301 B
JavaScript
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
function randomChar() {
|
|
return ALPHABET.charAt(Math.floor(Math.random()*62))
|
|
}
|
|
|
|
function createHash(len) {
|
|
var str = '';
|
|
while(str.length < len) str += randomChar();
|
|
return str;
|
|
}
|
|
|
|
module.exports = createHash;
|