Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Decoding HST File, or others

26 views
Skip to first unread message

Boogle

unread,
Feb 5, 2003, 4:07:32 PM2/5/03
to
Has anyone tried/succeeded in decoding the .hst file, or .xy file, or
any others? I'm looking for an easy way to access a game's race list,
and perhaps other information in the future. The planet and fleet
dumps can be a pain as one dumps only the owner name with no ID, and
hte other dumps only the player ID with no name.

Thanks,
Boogle

Dan Neely

unread,
Feb 6, 2003, 12:26:08 AM2/6/03
to
"Boogle" <b...@knob.com> wrote

The only file fully decoded is the xy. I think the headers for .m and .hst
files are known, but not thier contents. If the info isn't on
www.starsfaq.com I don't know where to have you look though.


James McGuigan

unread,
Feb 7, 2003, 3:04:54 PM2/7/03
to

I have a copy of starstat.c which is the code the Jeffs used to encode
the .xy file. I've attached the file contents inline below (without the
line wrap to preserve the code - copy/paste this into a text file in you need
to) - I've done this rather than a attachment in case some people have
difficulty reading the file and to keep a copy in the google groups archives.

I don't have any technical information on file formats in
www.starsfaq.com (IIRC this info isn't in the stars-r-us article database)

Your best bet for the file formats is searching the google groups
archives for rec.games.computer.stars
(http://www.google.com/advanced_group_search?hl=en) and if you don't
find the technical details in the archives, then maybe try to email some
of the people discussing them who seemed to know what they where talking
about as they might have something on the hard disks.

If you do dig up any useful information in your searches, it might be an
idea to re-post that information to the NG as a refresher for the rest of us.

--
Rules are written for those who lack the ability to truly reason,
But for those who can, rules become nothing more than guidelines,
And live their lives governed not by rules but by reason.
- James McGuigan

The Stars! FAQ (www.starsfaq.com)
Earth Emergency - A Call to Action (www.earthemergency.org)


starstat.c <file start>
----------------------------------------------------------------------

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define dtXY 0
#define dtLog 1
#define dtHost 2
#define dtTurn 3
#define dtHist 4
#define dtRace 5
#define dtMax 6

#define rtBOF 8 // Begining Of File Record Type

typedef struct _rtbof
{
char rgid[4]; // Magic number: "J3J3"
long lidGame; // Game ID

unsigned short verInc : 5, // 1.04c
verMinor : 7, // 1.04
verMajor : 4; // 1.00

unsigned short turn;
short iPlayer:5,
lSaltTime:11; // Encryption salt

unsigned short dt : 8, // File type dtXY, dtHost, dtLog, dtHist etc.
fDone : 1, // Player has submitted this turn (dtLog only).
fInUse : 1, // Host instance is using this file (dtHost, dtTurn).
fMulti : 1, // Multiple turns in this file (dtTurn only).
fGameOver : 1, // A winner has been declared
fShareware : 1, // The shareware version
unused : 3;
} RTBOF;

typedef struct _hdr
{
unsigned short cb : 10, // Size of the record in bytes not counting this header.
rt : 6; // Record Type (rtBOF etc)
} HDR;

char *szMagic = "J3J3";

char *rgszdt[7] = { "Universe Definition File", "Player Log File", "Host File", "Player Turn File",
"Player History File", "Race Definition File", "Unknown File" };

int main(int argc, char *argv[])
{
FILE *in;
short w;
HDR hdr;
RTBOF rtbof;

if(argc < 2)
{
fprintf(stderr, "StarStat filename\n\tDisplays status information about a Stars! game file.\n");
return 1;
}

in = fopen(argv[1], "rb");
if(!in)
{
fprintf(stderr, "StarStat: Unable to open '%s' for reading.\n", argv[1]);
return 2;
}

if (fread(&hdr, 1, sizeof(HDR), in) != sizeof(HDR) || hdr.rt != rtBOF
|| hdr.cb < sizeof(RTBOF) || fread(&rtbof, 1, sizeof(RTBOF), in) != sizeof(RTBOF)
|| strncmp(szMagic, &rtbof.rgid[0], 4) || rtbof.dt >= dtMax)
{
fprintf(stderr, "StarStat: %s does not appear to be a Stars! file.\n", argv[1]);
fclose(in);
return 3;
}

printf("Stars! Version: %d.%02d%c ", rtbof.verMajor,
rtbof.verMinor, !rtbof.verInc ? ' ' : ('a' - 1 + rtbof.verInc));
printf("%s", rgszdt[rtbof.dt]);
if (rtbof.fInUse)
printf(" (In Use)");
printf("\n");

printf("Unique Game Id Number: %08lx\n", (unsigned long) rtbof.lidGame);

switch (rtbof.dt)
{
case dtLog:
case dtHost:
case dtTurn:
printf("Game Year: %u", rtbof.turn+2400);
if (rtbof.dt == dtTurn && rtbof.fMulti)
{
fseek(in, -2, SEEK_END);
fread(&w, 1, 2, in);
printf(" to %u", w + 2400);
}

if (rtbof.fGameOver)
printf(" - Game Over");
printf("\n");

if (rtbof.iPlayer != -1)
{
printf("Player: %d", rtbof.iPlayer+1);
if (rtbof.fShareware)
printf(" - Shareware");
if (rtbof.dt == dtLog && rtbof.fDone)
printf(" - Submitted");
printf("\n");
}
break;
}

fclose(in);
return 0;
}

----------------------------------------------------------------------
starstat.c <file end>

Russ Lewis

unread,
Feb 17, 2003, 9:59:00 PM2/17/03
to
James McGuigan wrote:

> I have a copy of starstat.c which is the code the Jeffs used to encode
> the .xy file. I've attached the file contents inline below (without the
> line wrap to preserve the code - copy/paste this into a text file in you need
> to) - I've done this rather than a attachment in case some people have
> difficulty reading the file and to keep a copy in the google groups archives.
>
> I don't have any technical information on file formats in
> www.starsfaq.com (IIRC this info isn't in the stars-r-us article database)
>
> Your best bet for the file formats is searching the google groups
> archives for rec.games.computer.stars
> (http://www.google.com/advanced_group_search?hl=en) and if you don't
> find the technical details in the archives, then maybe try to email some
> of the people discussing them who seemed to know what they where talking
> about as they might have something on the hard disks.
>
> If you do dig up any useful information in your searches, it might be an
> idea to re-post that information to the NG as a refresher for the rest of us.

I've done a lot of looking into this; I've studied race files extensively. As you probably already know,
the race files, .mX and .xX files are all encrypted. I know (generally) the algorithm used to encrypt
the race files, as well as how to determine the ecryption key. But I haven't figured out exactly how
they turn the key into the encryption parameters.

The problem is, there is NO security. You do NOT need the password to decrypt a file. That means that
if anybody ever decrypted the format and published it, all games everywhere would be compromised. Any
player could open anybody else's turn file (without giving the password) and have a look.

I continue to dream that someday I'll crack the encryption algorithm, and provide a (password protected)
way for people to read & write Stars! files. Until then, I can't tell you much more.

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]


James McGuigan

unread,
Feb 18, 2003, 5:31:53 PM2/18/03
to
> ..[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] ..[ (a
> version.of(English).(precise.more)) is(possible) ] ?[ you
> want.to(help(develop(it))) ]

The password and the encryption would still be enough to keep honest people
honest, though you cheaters will always try it on.

If the encryption was cracked, then security would have to be based on
restricting access to the file itself. For human run games, the extra
ability to view the turns would make it a little eaiser for a dishonest host
to cheat (as in view turn files), but you have to trust the host anyway (a
dishonest host can cheat in other ways as well though).

Turn files are usually only sent out to the individual players, so in a
human hosted game this isn't a problem. For autohost, they would have to put
in password protection for the web download as well as the upload. Though
turn files could still be sent via email.

Unencrypting the game files would allow mapping programs to have access to
more infomation and also allow the potentual for a an external computer AI
to work on turn files.

If the encryption is cracked, then its unlikely we will see a new stars
patch to fix this.

Though by that time the stellarlegacy project
(http://stellarlegacy.sourceforge.net/) will hopefully be more complete and
open source replacement for stars (though its still in alpha stages).

Russ Lewis

unread,
Feb 20, 2003, 8:29:56 AM2/20/03
to
James McGuigan wrote:

> If the encryption was cracked, then security would have to be based on
> restricting access to the file itself. For human run games, the extra
> ability to view the turns would make it a little eaiser for a dishonest host
> to cheat (as in view turn files), but you have to trust the host anyway (a
> dishonest host can cheat in other ways as well though).

Right.

> Turn files are usually only sent out to the individual players, so in a
> human hosted game this isn't a problem. For autohost, they would have to put
> in password protection for the web download as well as the upload. Though
> turn files could still be sent via email.

Right.

> Unencrypting the game files would allow mapping programs to have access to
> more infomation and also allow the potentual for a an external computer AI
> to work on turn files.

I WANT THIS. Even more, I want to be able to work on 3rd part AI.

> If the encryption is cracked, then its unlikely we will see a new stars
> patch to fix this.

My thought is that, if I can crack it, I will create a server on the Internet
that does cracking for you. You will pass it an encrypted file and the
password, and it will return you an XML file that contains all of the data.
Likewise, eventually you would be able to input an XML file and have it output
the encrypted file...so that you could generate your own .X files.

That way, I don't have to release the algorithm, and the world at large will
only be able to view a file if they have the right password. Let's hope I get
good enough at debugging assembly :/

> Though by that time the stellarlegacy project
> (http://stellarlegacy.sourceforge.net/) will hopefully be more complete and
> open source replacement for stars (though its still in alpha stages).

How is that project going, anyhow?

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]

0 new messages