Recover lost jabber passwords in Psi’s config files


Imagine you have saved the password for your jabber account in Psi and now you can’t memorize. Fourtunately the encryption of Psi’ config file can be reversed.

The password is saved in file config.xml in an encrypted way. You can
recover it with the following code which I copied from psi’s source

#include <qstring.h>
#include <iostream>

int hexChar2int(char c)
        if(c >= 'A' && c <= 'F')
                return c - 'A' + 10;
        else if(c >= 'a' && c <= 'f')
                return c - 'a' + 10;
        else if(c >= '0' && c <= '9')
                return c - '0';

        return 0;

QString decodePassword(const QString &pass, const QString &key)
        QString result;
        unsigned int n1, n2;

        if(key.length() == 0)
                return pass;

        for(n1 = 0, n2 = 0; n1 < pass.length(); n1 += 4) {
                ushort x = 0;
                if(n1 + 4 > pass.length())
                x += hexChar2int(*4096;
                x += hexChar2int(*256;
                x += hexChar2int(*16;
                x += hexChar2int(;
                QChar c(x ^;
                result += c;
                if(n2 >= key.length())
                        n2 = 0;
        return result;

int main()
    QString password = "aaa000000000000000000000000000000000000000000";
    QString key = "";
    QString out = decodePassword(password,key);
    std::cout << out << std::endl;

Compile it with

$ g++ -I$QTDIR/include -L$QTDIR/lib -lqt-mt

My friend Dominik made some small modifications to the code above and added a Makefile. You can download the resulting archive PsiDescramble.tar.gz.

5 thoughts on “Recover lost jabber passwords in Psi’s config files”

  1. Please consider crafting this into a plug-in for Psi+

    Some JID created very late at night or after much sleep deprivation when it ‘seems like a good idea’ oft result in losing password to frailty in human recall. 😐

    Extra goodness if it were to play nicely on both Ubuntu and windows… but if only one then Ubuntu. πŸ™‚

    1. Yes, I know those situations. πŸ™‚

      Personally I haven’t used Psi for years, it seemed a bit abandoned. Is Psi+ the successor?

  2. psi-plus is a huge improvement over psi, complete with a plugin system and lots of useful plugins (eg. otr, finally!, and jingle support).

Comments are closed.