I regularly forget passwords. Today I couldn't remember my Jabber password. Fortunately I had it stored in Kopete on another machine. Looking in the .kde/share/config/kopeterc file I found a line
Password=[some unreadable non-letter ASCII]
How can I decrypt this? Obviously there must be some simple obfuscation at work. Googling around a bit and looking through Kopete's source I found the function that did this obfuscation: KStringHandler::obscure.
Looking at it's source it's quite obvious how to un-obfuscate the password:
- Open kopeterc in a hex editor
- Look for the "Password=" string. The following bytes are your password.
- Realize that these are three-byte chunks: [EF][BE][XX]. The first two bytes stay always the same.
- Subtract each third byte from 0x1001F. This will give you a two byte value (0xFFXX)
- strip off the leading 0xFF
- Look up the remaining byte in an ASCII chart
- repeat steps 4-6
Obviously this algorithm won't work for Unicode strings. If you should find time to write a program to do this, just write a wrapper for the obscure() function. However, if you don't have time or skills to do this, do it by hand as laid out above.
[I document this here because I already forgot how to do this once]