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
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.
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;
}