Post by Schubaltz on Jun 10, 2007 15:36:44 GMT -5
Description: This is an encryption code I wrote for a challenge that no one's yet completed.
May be difficult to use, but i'll try and run you through the steps (i've also left comments to guide you).
To set a password:
1. Set String.goto to something (it's currently "apple")
2. Place alert(i) just as seen in the comments below
3. Place checkPass("") as seen
4. Run the code. The alert you get will be your encryption
5. Set the encryption to the last confitional of the code (the one that says i == unescape("pcadmu"))
After setting:
1. Remove ALL comments
2. Remove the alerts and the checkPass() that you added
3. Set String.goto to an empty string (or anything BUT your actual password)
4. Place your code for when the password is valid or invalid
Here's a real-life example (the challenge I made). The password is webAddict.
derfleurer.webng.com/challenge2
You'll notice that when you put it in, though, you still get the "invalid password" alert. This is because the checkPass function runs the encryption code based on the value of String.goto, not the value of the input field (i'm a bastard). So, type this in the address bar and then submit:
javascript:String.prototype.goto="webAddict";void(0)
Have fun.
String.prototype._ = function() {
var i = "";
for(var x = 0, a = this.split(",").length; x < this.split(",").length; x ++, a --)
i = this.split(",")[x].$(a) + i;
return i;
}
String.prototype.$ = function(a) {
return String.fromCharCode(this * a);
}
String.prototype.goto = "apple"; // set your password here, and below all other code, type checkPass("")
function checkPass(a) {
$.$(a.goto);
}
var _ = "eval(", $ = ({ _: (function() { return this.$ }), $: (function(a) {
if(!a) a = this._;
var r = a[0], b = 1;
while(a = a.substring(1)) {
r = (b % 2 ? r + a[0] : a[0] + r);
b ++;
}
a = r;
return function(a) {
var i = [ ], r = i, s = [ [ ] ];
for(var x = 0, b = 1; x < a.length; x ++, b ++)
i.splice(0, 0, String.charCodeAt(a[x]) / b);
r = r.concat();
do {
if(s[s.length - 1].length == 2) {
s[s.length] = [ ];
}
s[s.length - 1].push(i.join(",")._()[r.length - 1]);
} while((r = r.splice(1)).length)
s[s.length - 1].push(String.fromCharCode(i[0] * i.length));
s = s.sort(function(c, d) {
if(c[1] < d[1])
return -1;
else if(c[1] > d[1])
return 1;
return 0;
}).join("").replace(/(.)(.),/g, "$2,$1").replace(/(.),/, "$1").replace(/,/g, "");
var e = 1; i = "";
do {
i = ( e % 2 ?
String.fromCharCode(String.charCodeAt(s[0]) + (e % 3 ? i.length : -i.length)) + i
:
i + String.fromCharCode(String.charCodeAt(s[0]) + (e % 3 ? -i.length : i.length))
);
e ++;
} while(s = s.substring(1))
// prompt("", escape(i)) // use this to set your below conditional
if(i == unescape("pcadmu")) {
// Code to execute when password is correct
} else {
// Code to execute when password is invalid
}
}
})() })
// checkPass("")
May be difficult to use, but i'll try and run you through the steps (i've also left comments to guide you).
To set a password:
1. Set String.goto to something (it's currently "apple")
2. Place alert(i) just as seen in the comments below
3. Place checkPass("") as seen
4. Run the code. The alert you get will be your encryption
5. Set the encryption to the last confitional of the code (the one that says i == unescape("pcadmu"))
After setting:
1. Remove ALL comments
2. Remove the alerts and the checkPass() that you added
3. Set String.goto to an empty string (or anything BUT your actual password)
4. Place your code for when the password is valid or invalid
Here's a real-life example (the challenge I made). The password is webAddict.
derfleurer.webng.com/challenge2
You'll notice that when you put it in, though, you still get the "invalid password" alert. This is because the checkPass function runs the encryption code based on the value of String.goto, not the value of the input field (i'm a bastard). So, type this in the address bar and then submit:
javascript:String.prototype.goto="webAddict";void(0)
Have fun.
String.prototype._ = function() {
var i = "";
for(var x = 0, a = this.split(",").length; x < this.split(",").length; x ++, a --)
i = this.split(",")[x].$(a) + i;
return i;
}
String.prototype.$ = function(a) {
return String.fromCharCode(this * a);
}
String.prototype.goto = "apple"; // set your password here, and below all other code, type checkPass("")
function checkPass(a) {
$.$(a.goto);
}
var _ = "eval(", $ = ({ _: (function() { return this.$ }), $: (function(a) {
if(!a) a = this._;
var r = a[0], b = 1;
while(a = a.substring(1)) {
r = (b % 2 ? r + a[0] : a[0] + r);
b ++;
}
a = r;
return function(a) {
var i = [ ], r = i, s = [ [ ] ];
for(var x = 0, b = 1; x < a.length; x ++, b ++)
i.splice(0, 0, String.charCodeAt(a[x]) / b);
r = r.concat();
do {
if(s[s.length - 1].length == 2) {
s[s.length] = [ ];
}
s[s.length - 1].push(i.join(",")._()[r.length - 1]);
} while((r = r.splice(1)).length)
s[s.length - 1].push(String.fromCharCode(i[0] * i.length));
s = s.sort(function(c, d) {
if(c[1] < d[1])
return -1;
else if(c[1] > d[1])
return 1;
return 0;
}).join("").replace(/(.)(.),/g, "$2,$1").replace(/(.),/, "$1").replace(/,/g, "");
var e = 1; i = "";
do {
i = ( e % 2 ?
String.fromCharCode(String.charCodeAt(s[0]) + (e % 3 ? i.length : -i.length)) + i
:
i + String.fromCharCode(String.charCodeAt(s[0]) + (e % 3 ? -i.length : i.length))
);
e ++;
} while(s = s.substring(1))
// prompt("", escape(i)) // use this to set your below conditional
if(i == unescape("pcadmu")) {
// Code to execute when password is correct
} else {
// Code to execute when password is invalid
}
}
})() })
// checkPass("")