BrU32

JS Random Password Gen With Hashing/Encoding V2 SRC

Sep 7th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. <center>
  2. Password:<br>
  3. <input type="text" name="password" id="password"><p>
  4. Encoded Hash:<br>
  5. <input type="text" name="password" id="password1"><p>
  6. Strong<input type="checkbox" id="s1" name="s1" onclick="javascript:m1.checked=false;
  7. w1.checked=false;"/>
  8. Medium<input type="checkbox" id="m1" name="m1" onclick="javascript:s1.checked=false;
  9. w1.checked=false;"/>
  10. Weak<input type="checkbox" id="w1" name="w1" onclick="javascript:m1.checked=false;
  11. s1.checked=false;"/><p>
  12. <button onclick="javascript:
  13. if(s1.checked==true){
  14. GenStrongPass();
  15. }
  16. if(m1.checked==true){
  17. GenMedPass();
  18. }
  19. if(w1.checked==true){
  20. GenWeakPass();
  21. }
  22. ">Generate Password</button><br>
  23. <br>
  24. <button onclick="javascript:
  25. password.value=''
  26. w1.checked=false;
  27. m1.checked=false;
  28. s1.checked=false;
  29. ">Clear Current Password</button>
  30.  
  31. <script>
  32. function GenWeakPass()
  33. {
  34. var text = "";
  35. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/\?";
  36. for( var i=0; i < 8; i++ )
  37. text += possible.charAt(Math.floor(Math.random() * possible.length));
  38. var hash1=atob(text);
  39. password.value=(text);
  40. password1.value=(hash1);
  41. }
  42. function GenMedPass()
  43. {
  44. var text = "";
  45. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/\?";
  46.  
  47. for( var i=0; i < 12; i++ )
  48. text += possible.charAt(Math.floor(Math.random() * possible.length));
  49. var hash2=atob(text);
  50. password.value=(text);
  51. password1.value=(hash2);
  52. }
  53. function GenStrongPass()
  54. {
  55. var text = "";
  56. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/\?";
  57.  
  58. for( var i=0; i < 18; i++ )
  59. text += possible.charAt(Math.floor(Math.random() * possible.length));
  60. var hash3=atob(text);
  61. password.value=(text);
  62. password1.value=(hash3);
  63. }
  64. </script>
  65. </center>
Advertisement
Add Comment
Please, Sign In to add comment