0

I was trying to recover some password data on my SQL SERVER 2012 files, unfortunately I forgot what encryption was used in encoding the password to the tables. I know that 0x3132333435 translates as 12345, as this was my test account before.

I tried to use hexdec() but no luck, there seems to be a pattern with the structure of the password. 0x3132333435 translates as 0x3(1)3(2)3(3)3(4)3(5) with the data 12345 being 'sandwiched' between hex 0x3 and 3's.

This is one of my code's part.

            $_SESSION['error'] = 'Cannot find account with the username';
        } else {
            $row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC);
            if (hexdec($password, $row['password'])) {
                $_SESSION['admin'] = $row['id'];
            }
            else{
                $_SESSION['error'] = 'Incorrect password';
            }
        }

I've read some of the topics about this as well, but I don't have any idea on how to implement it:

Currently, classes "wep" and "wpa" are suported. The WEP (Wired Equivalent Privacy) key can be either 5 or 13 bytes long. It can be provided either as an ASCII or hexadecimal string -- thus "12345" and "0x3132333435" are equivalent 5-byte keys (the "0x" prefix may be omit- ted). A file containing a WEP key must consist of a sin- gle line using either WEP key format. The WPA (Wi-Fi Protected Access) key must be provided as an ASCII string with a length between 8 and 63 bytes.

Is it possible to do it manually? Or is there some link that I can use as a guide or reference?

I am trying to use the old table (user's masterfile) so that my old users can still access the system. I'm currently using hash() for my new password table.

Dale K
  • 25,246
  • 15
  • 42
  • 71
pjustindaryll
  • 377
  • 3
  • 14
  • 1
    [This answer](https://stackoverflow.com/a/14486625/924299) might be helpful. It seems to use `hexdec()` to convert hex pairs to decimal and then `chr()` to convert the resulting number to ascii. – showdev Jul 16 '19 at 02:29
  • @showdev I completely forgot, it was nested. ````(chr(hexdec($password, $row['password'])))```` worked like charm! thank you for the link, it saved me. – pjustindaryll Jul 16 '19 at 02:47

0 Answers0