Sumber Kode

JavaScript Kit Encrypted Password Generator

  • JavascriptKit
  • 27 June 2014 at 16:58
  • Javascript
  • 969
  • 16
  • United States
 


Author: JavascriptKit Language: United States
License: Freeware
Size: 0 KB
Downloads: 1 times

 

JavaScript may not be the best way to password-protect a webpage, but for those who do not have access to a CGI-BIN, it may very well be the only way. To provide these people with a decent JavaScript password protector that will keep out at least the average surfer, I've created this encrypted password generator. This program dynamically encrypts the password to a page (differently each time) before saving it, making it a LOT harder for foul-minded users to break in. It differs from other good password scripts, such as Gate Keeper, in the following two areas:


The program dynamically encrypts the password (using several advanced JavaScript techniques) when storing it, so simply viewing the source will not reveal it (Most password protectors don't encrypt the password. Gatekeeper does not use a password).
  • Unlike Gate Keeper, the program does NOT simply take the surfer to the file he/she enters as the password. Instead, it navigates to a page only if the surfer correctly enters the password. Invalid passwords will result in an invalid password alert.

The program is similar to Gatekeeper, however, in that the file you are protecting must be renamed to match the password you have chosen for it.


Note: This program dynamically encrypts the password specified, so each time you use the program, the resulting output will be different, even for the same password. An added cushion of security!



<script>

var pass=new Array()
var t3=
var lim=4
pass[0]=GeUD6bWOOw6zsfv
pass[1]=LBlnPIEBAuuBQ1q
pass[2]=aW1aURryNi1knTw
pass[3]=5u1cMlS8A4fA4QT
pass[4]=4M5RMP5XBbrij63o
pass[5]=20M5RMP5XBbrij63

//configure extension to reflect the extension type of the target web page (ie: .htm or .html)
var extension=.html
var enablelocking=0
var numletter=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
var temp3=''
var cur=0


function max(which){
return (pass[Math.ceil(which)+(3&15)].substring(0,1))
}

function testit(input){
temp=numletter.indexOf(input)
var temp2=temp^parseInt(pass[phase1-1+(1|3)].substring(0,2))
temp2=numletter.substring(temp2,temp2+1)
return (temp2)
}


function submitentry(){
t3=''
verification=document.password1.password2.value
phase1=Math.ceil(Math.random())-6+(2<<2)
var indicate=true
for (i=(1&2);i<window.max(Math.LOG10E);i++)
t3+=testit(verification.charAt(i))
for (i=(1&2);i<lim;i++){
if (t3.charAt(i)!=pass[phase1+Math.round(Math.sin(Math.PI/2)-1)].charAt(i))
indicate=false
}
if (verification.length!=window.max(Math.LOG10E))
indicate=false
if (indicate)
window.location=verification+extension
else
alert(Invalid password. Please try again)
}
</script>


<table border=1 cellspacing=0 cellpadding=0 bgcolor=#FFFFBD>
  <tr>
    <td width=100%><form name=password1><div align=center><center><p><strong>Enter password: </strong><input
      type=text name=password2 size=15><br>
      <input type=button value=Submit onClick=submitentry()></p>
      </center></div>
    </form>
    </td>
  </tr>
</table>

comments powered by Disqus

Kode Terkait

Create Calculator Using Javascript

How to Write a BlackBerry Application – Lesson 3: Create shortcuts and more

How to write a BlackBerry application – Lesson 2: Mail API, Invoke API, Menu

How to write your first BlackBerry application – Lesson 1: UI fields

Mysql Response too slow accessed from website

Get Content of RSS Pasarkode

Apache setting for CodeIgniter when upload in sub domain

Ajax load content

Import Large Database File Size

Get Location Using GeoPlugin



Kategori

Tag Terhubung