Advertisement
stuppid_bot

Random Password &Mask

Dec 28th, 2016
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function mask(n) {
  2.   let p = '0'.repeat(32);
  3.   let s = n.toString(2);
  4.   return p.slice(0, -s.length) + s;
  5. }
  6.  
  7. function randPassword(length = 42) {
  8.   let out = '';
  9.   while (out.length < length)
  10.     // Символы в диапазоне 33-126
  11.     out += String.fromCharCode(Math.floor(Math.random() * (127 - 33)) + 33);
  12.   return out;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement