#!perl -w use strict; use IO::File; # (C) 2003-2007 Willem Jan Hengeveld # Web: http://www.xs4all.nl/~itsme/ # http://wiki.xda-developers.com/ # # $Id: himalayanbfdecode.pl 1502 2007-04-15 07:54:20Z itsme $ # # perl script demonstrating how to decrypt the nbf files for the # htc-himalaya, and htc-blueangel my $ifn= shift or die "need ifn\n"; my $ofn= shift or die "need ofn\n"; my @xor= map { eval($_) } @ARGV; my $ifh= IO::File->new($ifn, "r") or die "$ifn: $!\n"; binmode $ifh; my $data; $ifh->read($data, -s $ifn) or die "reading $ifn: $!\n"; $ifh->close(); my @dwords = unpack("V*", $data); my $xorreddata= pack("V*", map { $dwords[$_] ^ $xor[$_%@xor] } 0..$#dwords); my $ofh= IO::File->new($ofn, "w") or die "$ofn: $!\n"; binmode $ofh; $ofh->print($xorreddata) or die "reading $ofn: $!\n"; $ofh->close();