Redshirt2 decryption!
Moderators: jelco, bert_the_turtle, Chris
Google is there for a reason.
I'm not developing software for the end user. I write code for fellow programmers.
If a person who isn't knowledgeable in a field jumps in a conversation dedicated to that field, I'm not going to spoonfeed that individual. Nor would I jump into a thread on complex modelling issues - a subjects that I am almost completely ignorant of - asking basic questions on how to load models. That is what google is for.
I'm not developing software for the end user. I write code for fellow programmers.
If a person who isn't knowledgeable in a field jumps in a conversation dedicated to that field, I'm not going to spoonfeed that individual. Nor would I jump into a thread on complex modelling issues - a subjects that I am almost completely ignorant of - asking basic questions on how to load models. That is what google is for.
Eridius: Thanks for the code. It works very nicely.
jaysc: From the man pages --
&c. &c.
It came installed with OS X on my lappy. It also runs on *nix. Don't know about Windows.
xander
jaysc: From the man pages --
Code: Select all
NAME
ruby - Interpreted object-oriented scripting language
<snip>
PREFACE
Ruby is an interpreted scripting language for quick and easy object-
oriented programming. It has many features to process text files and
to do system management tasks (as in Perl). It is simple, straight-
forward, and extensible.
If you want a language for easy object-oriented programming, or you
don't like the Perl ugliness, or you do like the concept of lisp, but
don't like too much parentheses, Ruby may be the language of your
choice.
&c. &c.
It came installed with OS X on my lappy. It also runs on *nix. Don't know about Windows.
xander
I tried the ruby code in Windows, but it always crashes upon completion though the resulting file seems complete. When I encrypt back however, the result is different than the original file (this without editing). The only thing I changed in the ruby code is removing the first line as I am in Windows. Why would the same source code have such different results on the two OS's?
Different output
Ignore the fact that the re-encrypted output is different from the original. It doesn't matter. The reason for this is because the decryption process is a one-way transform - it loses data, so you can't do an identical reversion of the process. If you read the code, it loses data where it checks if the byte is less than 0x20 and adds 0x5f to it - when re-encrypting, if you have, say, 0x6c, there's no way to tell if 0x5f should be subtracted or not. However, it doesn't matter - the re-encrypted version decrypts to exactly the same text as the original version decrypted. So there's no problem with this.
oldbushie wrote:Uniter's code actually does a perfect transform there and back, I checked...
I just checked his code, and it's the same as my code (except in a different language). There's no way it should be able to produce different output from mine.
And again, the output from mine is equivalent to the existing file. Some data may be different, but it's not a one-to-one transform. Multiple inputs can equal the same output.
In both programs, in one form another, the following is done:
Sure this is correct?
Code: Select all
if (cp < 0x20)
cp -= 0x5f; Jackmn wrote:In both programs, in one form another, the following is done:Sure this is correct?Code: Select all
if (cp < 0x20)
cp -= 0x5f;
Yeah, it works. When printing the character the negative integer is wrapped around. It may not produce ASCII chars, but it does produce something that can be decrypted again.
My question is this: do you need to be able to re-encrypt files? As far as the game is concerned, you can place un-encrypted files in the directories, and they will work. So, other than the inherent |337-ness of it, why do you need an encrypter?
Please, this is not a flame, only a question. It is not meant to be incendiary.
xander
Please, this is not a flame, only a question. It is not meant to be incendiary.
xander
- NeoThermic
- Introversion Staff

- Posts: 6256
- Joined: Sat Mar 02, 2002 10:55 am
- Location: ::1
- Contact:
xander wrote:My question is this: do you need to be able to re-encrypt files? As far as the game is concerned, you can place un-encrypted files in the directories, and they will work. So, other than the inherent |337-ness of it, why do you need an encrypter?
Please, this is not a flame, only a question. It is not meant to be incendiary.
xander
The "defaults" of a level are in text format, yes. All your saves though, are not. Thus if you want to edit your progress, you'll need the redshirt2 stuff
NeoThermic
-
monochrome
- level0
- Posts: 6
- Joined: Sun Apr 24, 2005 10:02 pm
Code: Select all
void deshirt(char *filename)
{
int i;
char cp, *line;
FILE *fp;
if ((fp = fopen(filename, "r")) == NULL) {
printf("Unable to open: %s\n", filename);
exit(1);
}
fgets(line, 10, fp);
The line pointer is never initialized, so the fgets writes to unallocated memory = kaboom in most cases. Replace with:
Code: Select all
void deshirt(char *filename)
{
int i;
char cp = 0;
char line[10];
FILE *fp;
The while statement in both funcitons can also be replaced with:
Code: Select all
while ((cp = fgetc(fp)) != EOF) {
which covers the case when fgetc actually returns EOF (you get an off-by-one error and encrypt / decrypt the EOF marker otherwise).
Who is online
Users browsing this forum: No registered users and 1 guest




