ta-sa.org - Psi_pw_decode

(best viewed in any resolution with any HTML enabled browser)


Main:
Index
Contact
Links

Studies:
Informatics
Scripts
Material

Projects:
Git repository

Programs:
cdplay
ECMS
lip.C
baseclc.c
nfa-util.C
tm.C
termreplace
psi_pw_decode
bummskraut

Perl:
AnyEvent::XMPP
Net::XMPP2
AnyEvent::IRC
Object::Event
AnyEvent::HTTPD
AnyEvent::EditText
MIDI::Sequencer

Music:
Ta-Sa Music
Languages:
LR Grammar Collection

Deliantra:
Deliantra

GNU Smalltalk:
Links

Other:
Laughing man logo
ta-sa.org

Java must DIE


Psi_pw_decode - last change: added the rest of the content for the new website, Sat Apr 5 16:42:15 2008 +0200

psi_pw_decode - A password decoder for psi account configuration file (psi version 0.10 - maybe also earlier and later)

Because psi uses a braindamaged encoding for the account passwords in the configuration file i wrote this to make transition from psi to gaim easier:

#!/usr/bin/perl
use XML::DOM::XPath;

sub decode_password {
   my ($pw, $jid) = @_;
   my ($cpw, $n, @pw) = ('', 0, split //, $pw);
   while (@pw) {
      my $x;
      $x += hex (shift @pw) * 4096;
      $x += hex (shift @pw) * 256;
      $x += hex (shift @pw) * 16;
      $x += hex (shift @pw);
      $cpw .= chr ($x ^ ord(substr $jid, $n, 1));
      $n++;
      $n = $n >= length $pw ? 0 : $n;
   }
   $cpw
}

my $parser = XML::DOM::Parser->new;
my $doc = $parser->parsefile ("$ENV{HOME}/.psi/profiles/default/config.xml");
for ($doc->findnodes ('/psiconf/accounts/*')) {
   my $jid = $_->findnodes ('jid');
   my $pw  = $_->findnodes ('password');
   my $cpw = decode_password ($pw, $jid);
   print "$jid\t$cpw\n";
}
All logos and trademarks on this site are property of their respective owner. Site admin is: elmex@ta-sa.org