Redshirt2 decryption!

Anything and everything

Moderators: jelco, bert_the_turtle, Chris

Cade
level0
Posts: 5
Joined: Sat Mar 05, 2005 4:34 am
Contact:

Postby Cade » Sun Mar 06, 2005 4:55 am

Jackmn wrote:
Cade wrote:Whole VB Code, works properly when decoding but not encoding. Anyone know why? Command1 decodes, command2 encodes, assuming the data is stored in text1.text
Not to be a prick, but you really need to tab your code.


Everyone tells me that :?

Right, changed Integer to Long.

Any ideas why encoding doesnt work?

Edit: I opened and decoded the language file. It has corrupted my fragile little mind.
Uniter
level0
Posts: 2
Joined: Tue Jul 06, 2004 7:19 pm

Postby Uniter » Sun Mar 06, 2005 8:30 pm

LOL, RFC Compliant code... adds/ removes redshirt2 tag appropriately.

De-Redshirt2

Code: Select all

#include <stdlib.h>
#include <stdio.h>
int main() {
   int KTIndex=0;
   char CurrChar, KeyTable[16] = {0x1F, 0x07, 0x09, 0x01, 0x0B, 0x02, 0x05, 0x05, 0x03, 0x11, 0x28, 0x0C, 0x23, 0x16, 0x1B, 0x02};
   FILE * Encd;
   FILE * Outf;
   Encd = fopen ("RedOut.txt","rb");
   Outf = fopen ("RedIn.txt","wb+");
   printf("Adding RedShirt2\n");
   fputs ("redshirt2",Outf);
    if ((Encd!=NULL)&&(Outf!=NULL)) {
      while(true) {
         CurrChar=fgetc (Encd);
         if (CurrChar==EOF) break;
         if(CurrChar > 0x20) {
            KTIndex++;
            KTIndex%=16;

            CurrChar+=KeyTable[KTIndex];

            if(CurrChar < 0x20)
               CurrChar-=0x5f;
         }
         fputc (CurrChar , Outf);
      }
   }
   else ;

   return(0);
}



Redshirt2

Code: Select all

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main() {
   int KTIndex=0;
   char CurrChar, KeyTable[16] = {0x1F, 0x07, 0x09, 0x01, 0x0B, 0x02, 0x05, 0x05, 0x03, 0x11, 0x28, 0x0C, 0x23, 0x16, 0x1B, 0x02};
   FILE * Encd;
   FILE * Outf;
   Encd = fopen ("RedIn.txt","rb");
   Outf = fopen ("RedOut.txt","wb+");
   printf("fseek()\n");
   fseek (Encd,strlen("redshirt2"),SEEK_SET); //uses strlen just to show....
    if ((Encd!=NULL)&&(Outf!=NULL)) {
      while(true) {
         CurrChar=fgetc (Encd);
         if (CurrChar==EOF) break;
         if(CurrChar > 0x20) {
            KTIndex++;
            KTIndex%=16;

            CurrChar-=KeyTable[KTIndex];

            if(CurrChar < 0x20)
               CurrChar+=0x5f;
         }
         fputc (CurrChar , Outf);
      }
   }
   else ;

   return(0);
}
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Mon Mar 07, 2005 12:42 am

Not to be a total n00b, but how to I compile / use this code? If it helps, I am running Mac OS X, and I do have the developer tools installed. My only experience with any kind of C code is typing configure / make / make install on a Linux box 5 years ago ^_^

Thanks,
xander
Gaspar
level1
level1
Posts: 25
Joined: Mon Jan 24, 2005 2:24 pm
Location: Shrewsbury, UK

Postby Gaspar » Mon Mar 07, 2005 2:01 pm

I'd also like to know this but for windows. Any help would be much appriciated.

Thanks In Advance
User avatar
vogelap
level2
level2
Posts: 80
Joined: Tue Jan 15, 2002 2:13 am
Location: Cincinnati, Ohio, USA
Contact:

Postby vogelap » Mon Mar 07, 2005 2:51 pm

Gaspar wrote:I'd also like to know this but for windows. Any help would be much appriciated.

Same here.
DaveNI
level0
Posts: 6
Joined: Tue Mar 01, 2005 7:26 pm

VB Code

Postby DaveNI » Mon Mar 07, 2005 2:54 pm

Cade wrote:
Jackmn wrote:
Cade wrote:Whole VB Code, works properly when decoding but not encoding. Anyone know why? Command1 decodes, command2 encodes, assuming the data is stored in text1.text
Not to be a prick, but you really need to tab your code.


Everyone tells me that :?

Right, changed Integer to Long.

Any ideas why encoding doesnt work?

Edit: I opened and decoded the language file. It has corrupted my fragile little mind.


OK, I've just run a couple of test strings - e.g abcdefabcdef, 1234567890, abcdefghijklmnopqrstuvwxyz, through the code.

Key in the string and then press the decode and encode buttons which should return the original text - the alpha strings work fine, but the numeric strings (or any string with one or more of the more esoteric ascii characters) does not come back correctly after the cycle.

Hope this gives some clues - I'll look at the code further later.

DaveG 8)
DaveNI
level0
Posts: 6
Joined: Tue Mar 01, 2005 7:26 pm

Figured out the encryption error

Postby DaveNI » Mon Mar 07, 2005 3:54 pm

in the vb code the error in the encryption is

If CP < &H20 Then
CP = CP - &H5F
End If

Which if you follow the logic says that if the character is less than ascii 32, then subtract 95.

the code should be

If CP > &H7F then
CP = CP - &H5F
End If

:D

DaveG
Draugluin
level1
level1
Posts: 14
Joined: Tue Mar 29, 2005 1:52 am

Postby Draugluin » Tue Mar 08, 2005 5:45 am

VB.net binary, encrypts and decrypts
http://www.draugluin.com/redshirt2_tool.zip
Put the exe somewhere and run it. Ctrl-V to paste, Ctrl-A to select all, Ctrl-C to copy. No saving or loading, just wanted to get this out.
  • I used the posted vb code and put a button on it
  • It assumes encrypted text starts with "redshirt2"
  • It's pretty slow on big things
  • Probably requires the .NET Framework

edit:added more, etc
Cade
level0
Posts: 5
Joined: Sat Mar 05, 2005 4:34 am
Contact:

Re: Figured out the encryption error

Postby Cade » Tue Mar 08, 2005 8:06 am

DaveNI wrote:in the vb code the error in the encryption is

If CP < &H20 Then
CP = CP - &H5F
End If

Which if you follow the logic says that if the character is less than ascii 32, then subtract 95.

the code should be

If CP > &H7F then
CP = CP - &H5F
End If

:D

DaveG


This works. Thanks. Ive uploaded a compiled exe. However, due on part to my lazyness, remove redshirt2 from the beginning of the text when decoding.

http://aura-blue.com/cade/redshirt2.exe
User avatar
Starfyre
level5
level5
Posts: 3247
Joined: Sat Jun 29, 2002 3:00 pm
Location: in the tree house

Postby Starfyre » Tue Mar 08, 2005 8:58 am

Draugluin wrote:VB.net binary, encrypts and decrypts
http://www.draugluin.com/redshirt2_tool.zip
Put the exe somewhere and run it. Ctrl-V to paste, Ctrl-A to select all, Ctrl-C to copy. No saving or loading, just wanted to get this out.


Thanks, man, works like a dream.
Even for programming-stupid people like me :D
Draugluin
level1
level1
Posts: 14
Joined: Tue Mar 29, 2005 1:52 am

Postby Draugluin » Wed Mar 09, 2005 2:52 am

Updated, added automatic copy to clipboard option. Whatever's in the window after you hit the magic button gets put into the clipboard. Same place. http://www.draugluin.com/redshirt2_tool.zip
Draugluin
level1
level1
Posts: 14
Joined: Tue Mar 29, 2005 1:52 am

Postby Draugluin » Wed Mar 09, 2005 3:08 am

Shouldn't this be moved to modding?
User avatar
Jackmn
level5
level5
Posts: 1378
Joined: Thu Feb 07, 2002 5:21 pm

Postby Jackmn » Wed Mar 09, 2005 3:25 am

Yes. There wasn't a modding section when I first made it =)
Cyberdyne
level1
level1
Posts: 53
Joined: Thu Mar 03, 2005 1:24 am

Postby Cyberdyne » Sun Mar 13, 2005 4:10 pm

http://www.cyberdyne.homecall.co.uk/Redshirt2.rar

Command line tool to decrypt/encrypt Redshirt2.
Automatic removal and insertion of redshirt2 header.
Included .bat files decrypt/encrypt all files in your Darwinia user directory.
Edit path to your own user directory in .bat files
e.g.
FOR %%A IN ("D:\Darwinia\users\Cyberdyne") DO SET STRING=%%A

Usage: Redshirt2 [-d] [-e] <source file> <output file>

Options
-d decrypts redshirt2
-e encrypts redshirt2
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Tue Apr 05, 2005 9:17 pm

As this question did not really get answered a while back, I will ask again: is there anyone that can help me get this running on a Mac? I know very little about compiling code, and would appreciate either (a) a walkthrough on compiling this thing for OS X or (b) a compiled binary.

Thank you,
xander

Return to “General”

Who is online

Users browsing this forum: No registered users and 7 guests