I found such a program, which should calculate the password of the router from the hash. It seems that the password is encrypted xor'om

$Password = "89929E87BECABDC8C6BC"; for($i=0;$i<strlen($Password);$i+=2){ echo "&#".(255-hexdec($Password[$i].$Password[$i+1])).";"; } 

It is not clear what interpreter or compiler to use to run. Tell me what language is written programmulina and what it can run.

  • In English. I guess? - Sergey

1 answer 1

This is PHP.

Can translate to another language. For example, C #:

 string password = "89929E87BECABDC8C6BC"; for (int i=0; i < password.Length; i += 2) Console.Write("&#" + (255-hexdec(password[i], password[i+1])) + ";"; int hexdec(char c1, char c2) { string hexdigits = "0123456789ABCDEF"; return hexdigits.IndexOf(c1) * 16 + hexdigits.IndexOf(c2); } 

The same on C ++:

 std::string password = "89929E87BECABDC8C6BC"; for (int i = 0; i < password.size(); i += 2) std::cout << "&#" << (255-hexdec(password[i], password[i+1])) << ";"; int hexdec(char c1, char c2) { std::string hexdigits = "0123456789ABCDEF"; return hexdigits.find(c1) * 16 + hexdigits.find(c2); } 

If you want to see the password itself, replace the output with this:

 std::cout << (char)(255-hexdec(password[i], password[i+1])); 
  • Well, what could it be pearl? - KoVadim
  • Perl doesn't have strlen? Then only PHP. --- Checked, and really, thanks! Updated the answer. - VladD
  • the point is not whether it is strlen, the point is that we see such an appeal $Password[$i] , which means that Password should be an array. But then when calling strlen it would have to be written as @Password , since $Password is a completely different variable. - KoVadim
  • Thanks people, but how can I run it under Linux? Never dealt with php! - Ruslan
  • one
    Understood, thank you - these are ASCII codes in dec - Ruslan