|
-
Sep 26th, 2007, 09:58 AM
#1
Thread Starter
Junior Member
What should be value of pass variable?
Consider this javascipt code:
[pass is a unknown variable n assume declared]
-------------------
var temp = 0;
var alpha = "abcdefghijklmnopqrstuvwxyz";
var char1;
for (i = 0; i < pass.length; i++)
{
char1 = pass.charAt(i);
buf = (alpha.indexOf(char1));
buf += 1;
temp *= 26;
temp += buf;
}
----------------
can anyone tell the value of pass (string) for which temp = 913216169672
Plzz urgent
also tel ,How to create the reverse code to get pass if possible
-
Sep 26th, 2007, 03:00 PM
#2
Fanatic Member
Re: What should be value of pass variable?
I don't think anyone would be able to figure out exactly what word produced that number, but it would be easy to brute force it since multiple input strings could end up resolving to the same number.
If your problem is solved, please use the Mark Thread As Resolved under Thread Tools!
Show Appreciation. Rate Posts!
-
Sep 27th, 2007, 11:32 AM
#3
Fanatic Member
Re: What should be value of pass variable?
The password was:
direction
Code:
string alpha = "abcdefghijklmnopqrstuvwxyz";
long num = 913216169672;
string password = string.Empty;
while (num > 0)
{
long rem = num % 26; //mod
password = (alpha[(int)rem - 1]) + password;
num = (num - rem) / 26;
}
If your problem is solved, please use the Mark Thread As Resolved under Thread Tools!
Show Appreciation. Rate Posts!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|