Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-27-2005, 09:50 AM   #1
Registered: Mar 2005
Distribution: Ubuntu 7.10
Posts: 40

Rep: Reputation: 15
A Perl script doesn't properly work

I've a problem with a Perl script, it gives me an incorrect output. If I run it with:
perl A4F2-C6BB-1F44
it prints:
 Usage : e-mail key-id
 e-mail : your e-mail
 key-id : a string in hex that has a XXXX-XXXX-XXXX format
 output:  9E-8D-D5-37-6C-89
I know it's incorrect, because if I ran it in my old SuSE 9.1 (I've FC4 now) the output was other.

Can someone run it with the same data that I and post me the results?

The link for it is:
(I can't post attachments and URLs... )
Old 11-27-2005, 12:38 PM   #2
Registered: May 2005
Posts: 378

Rep: Reputation: 33
We'll need to have a copy of if you want us to run it.

Edit: just noticed your well hidden link to the script, but can't download it.

Can you post the content, within [ code ] tags?

Last edited by eddiebaby1023; 11-27-2005 at 12:43 PM.
Old 11-28-2005, 09:04 AM   #3
Registered: Mar 2005
Distribution: Ubuntu 7.10
Posts: 40

Original Poster
Rep: Reputation: 15
use Digest::MD5  qw(md5_hex);
printf "Usage : e-mail key-id\ne-mail : your e-mail\nkey-id : a string in hex that has a XXXX-XXXX-XXXX format\n";

$pad = pack("H2048", "00000000963007772c610eeeba51099919c46d078ff46a7035a563e9a395649e3288db0ea4b8dc791ee9d5e088d9d2972b4cb609bd7cb17e072db8e7911dbf906410b71df220b06a4871b9f3de41be847dd4da1aebe4dd6d51b5d4f4c785d38356986c13c0a86b647af962fdecc9658a4f5c0114d96c0663633d0ffaf50d088dc8206e3b5e10694ce44160d5727167a2d1e4033c47d4044bfd850dd26bb50aa5faa8b5356c98b242d6c9bbdb40f9bcace36cd832755cdf45cf0dd6dc593dd1abac30d9263a00de518051d7c81661d0bfb5f4b42123c4b3569995bacf0fa5bdb89eb802280888055fb2d90cc624e90bb1877c6f2f114c6858ab1d61c13d2d66b69041dc760671db01bc20d2982a10d5ef8985b1711fb5b606a5e4bf9f33d4b8e8a2c9077834f9000f8ea8099618980ee1bb0d6a7f2d3d6d08976c6491015c63e6f4516b6b62616c1cd83065854e0062f2ed95066c7ba5011bc1f4088257c40ff5c6d9b06550e9b712eab8be8b7c88b9fcdf1ddd62492dda15f37cd38c654cd4fb5861b24dce51b53a7400bca3e230bbd441a5df4ad795d83d6dc4d1a4fbf4d6d36ae96943fcd96e34468867add0b860da732d0444e51d03335f4c0aaac97c0ddd3c710550aa41022710100bbe86200cc925b56857b3856f2009d466b99fe461ce0ef9de5e98c9d9292298d0b0b4a8d7c7173db359810db42e3b5cbdb7ad6cbac02083b8edb6b3bf9a0ce2b6039ad2b1743947d5eaaf77d29d1526db048316dc73120b63e3843b64943e6a6d0da85a6a7a0bcf0ee49dff099327ae000ab19e077d44930ff0d2a3088768f2011efec206695d5762f7cb67658071366c19e7066b6e761bd4fee02bd3895a7ada10cc4add676fdfb9f9f9efbe8e43beb717d58eb060e8a3d6d67e93d1a1c4c2d83852f2df4ff167bbd16757bca6dd06b53f4b36b248da2b0dd84c1b0aaff64a0336607a0441c3ef60df55df67a8ef8e6e3179be69468cb361cb1a8366bca0d26f2536e2685295770ccc03470bbbb91602222f260555be3bbac5280bbdb2925ab42b046ab35ca7ffd7c231cfd0b58b9ed92c1daede5bb0c2649b26f263ec9ca36a750a936d02a906099c3f360eeb8567077213570005824abf95147ab8e2ae2bb17b381bb60c9b8ed2920dbed5e5b7efdc7c21dfdb0bd4d2d38642e2d4f1f8b3dd686e83da1fcd16be815b26b9f6e177b06f7747b718e65a0888706a0fffca3b06665c0b0111ff9e658f69ae62f8d3ff6b6145cf6c1678e20aa0eed20dd75483044ec2b30339612667a7f71660d04d476949db776e3e4a6ad1aedc5ad6d9660bdf40f03bd83753aebca9c59ebbde7fcfb247e9ffb5301cf2bdbd8ac2baca3093b353a6a3b4240536d0ba9306d7cd2957de54bf67d9232e7a66b3b84a61c4021b685d942b6f2a37be0bb4a18e0cc31bdf055a8def022d");

@pad = unpack("L256",$pad);

@owner = unpack("C*",$ARGV[0]);
@regid = reverse unpack("C*", pack("H*", substr($ARGV[1],5,4).substr($ARGV[1],10,4)));

@tab = (@regid, @owner);
$g = $pad[71];

foreach $c(@tab)
	$i = ($c^$g) & 0xff;
	$g = ($g>>8) ^ $pad[$i];

$key = $g << 16;
$g = ($g>>8) ^ ($pad[$g & 0xff]);
$g = ($g>>8) ^ ($pad[$g & 0xff]);
$key = $key | ( (($g>>16)^$g) & 0xffff);

$keystr =  uc(unpack("H*", pack("N",$key)));
$digest = md5_hex("$keystr\n");

$keystr = $keystr.uc(substr($digest,0,4));
$keystr =~ s/^(..)(..)(..)(..)(..)(..)$/\1-\2-\3-\4-\5-\6/;
printf "output:  %s\n", $keystr;
Old 11-28-2005, 10:36 AM   #4
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
this code has been obfuscated.
You'll need to download a new version or something.
Old 11-29-2005, 01:02 AM   #5
Registered: Mar 2005
Distribution: Ubuntu 7.10
Posts: 40

Original Poster
Rep: Reputation: 15
OK, and if I downloaded it with aMule? There was only one file of this sort...

How to fix it manually?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
Perl shell-out to script dunna work. Works on command line. Why? jlangelier Linux - Software 1 08-28-2004 02:00 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
Perl script for website won't work klintonray Programming 5 07-27-2003 06:04 AM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 05:03 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration