mat
03-26-2003, 09:55 AM
(the scenario is a html page with a 'go' link. when you click that link it runs the function 'Check()' - brings up the js input box telling you to enter pass, and checks if it is right or not)
Is this code below secure or can you get a pass?
function Check(){
pass = prompt("Enter your password.","")
if(pass==null || pass==""){
alert("You did not enter a password!");
if(pass==""){
Check()
}
}
else{
var lpass=(pass.length)+1
for (l=1; l<lpass; l++){
K[l]=pass.charAt(l)
}
var transmit=0;
for (y=1; y<lpass; y++){
for(x=0; x<62; x++){
if (K[y]==base[x]){
transmit+=f[x]
transmit*=y
}
}
}
if (transmit==parseInt(actn1))
go()
else
inc()
}
}
function go(){
alert(actn2);
location.href=pass+".html";
}
function PVpassword(action) {
if (Array) {
actn1 = action[1];
actn2 = action[2];
z=23;
y=28;
for (x=0; x<10; x++){
f[x]=x<<9
f[x]+=23
}
for (x=10; x<36; x++){
y=y<<1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x<62; x++){
z=z<<1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
iCounter = 3;
Check();
}
}
// --></script>
</csscriptdict>
<csactiondict>
<script><!--
CSAct[/*CMP*/ 'B8D7EDB61'] = new Array(PVpassword,'9096','Welcome!');
// --></script>
Is this code below secure or can you get a pass?
function Check(){
pass = prompt("Enter your password.","")
if(pass==null || pass==""){
alert("You did not enter a password!");
if(pass==""){
Check()
}
}
else{
var lpass=(pass.length)+1
for (l=1; l<lpass; l++){
K[l]=pass.charAt(l)
}
var transmit=0;
for (y=1; y<lpass; y++){
for(x=0; x<62; x++){
if (K[y]==base[x]){
transmit+=f[x]
transmit*=y
}
}
}
if (transmit==parseInt(actn1))
go()
else
inc()
}
}
function go(){
alert(actn2);
location.href=pass+".html";
}
function PVpassword(action) {
if (Array) {
actn1 = action[1];
actn2 = action[2];
z=23;
y=28;
for (x=0; x<10; x++){
f[x]=x<<9
f[x]+=23
}
for (x=10; x<36; x++){
y=y<<1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x<62; x++){
z=z<<1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
iCounter = 3;
Check();
}
}
// --></script>
</csscriptdict>
<csactiondict>
<script><!--
CSAct[/*CMP*/ 'B8D7EDB61'] = new Array(PVpassword,'9096','Welcome!');
// --></script>