Advertisement
Shailrshah

One-Time Password Generation

Feb 20th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3.     <title>One-Time Password</title>
  4.     <script type = "text/javascript">
  5.         function generateOTP(limit){
  6.             var symbols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  7.             var OTP = '';
  8.             for(var i = 0; i < limit; i++)
  9.                 OTP += symbols.charAt((Math.random()*1000)%symbols.length)
  10.             return(OTP);
  11.         }
  12.     </script>
  13. </head>
  14. <body>
  15.     <form name = "OTP">
  16.         Size of OTP: <input type = "text" name = "textarea" value ="8" size = "1"/>
  17.         <input type = "submit" value ="Generate OTP" onClick = "alert('OTP is '+generateOTP(OTP.textarea.value))" />
  18.     </form>
  19. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement