Thread: Encryption Help

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    1

    Encryption Help

    I am working on re-creating a map for a game that uses a code basically the same as C, however I have run into a problem. The original author gave me all the code, but past that is not willing to help.

    There is a decent size method for encrypting data in this, and I have all of the code, but am not sure exactly what is going on, I would love to convert it to a small C program where I could enter the desired values, and it would put them into the encryption for me, but this is beyond me, if anyone is interested in helping, reply here or email me [email protected]
    thanks!

    (I can't post the code here first, because it exceeds post length, and second because I don't know if the original author wants it to be open source particularly).


    Thanks in advanced!


    Edit:

    here is the start of the encryption function, just so you have an idea what I'm talking about:


    }
    int[64][4] k;
    int[8][4] init;
    void hashInitialize() {
    k[0][0] = 0x42; k[0][1] = 0x8a; k[0][2] = 0x2f; k[0][3] = 0x98;
    k[1][0] = 0x71; k[1][1] = 0x37; k[1][2] = 0x44; k[1][3] = 0x91;
    k[2][0] = 0xb5; k[2][1] = 0xc0; k[2][2] = 0xfb; k[2][3] = 0xcf;
    k[3][0] = 0xe9; k[3][1] = 0xb5; k[3][2] = 0xdb; k[3][3] = 0xa5;
    k[4][0] = 0x39; k[4][1] = 0x56; k[4][2] = 0xc2; k[4][3] = 0x5b;
    k[5][0] = 0x59; k[5][1] = 0xf1; k[5][2] = 0x11; k[5][3] = 0xf1;
    k[6][0] = 0x92; k[6][1] = 0x3f; k[6][2] = 0x82; k[6][3] = 0xa4;
    k[7][0] = 0xab; k[7][1] = 0x1c; k[7][2] = 0x5e; k[7][3] = 0xd5;
    k[8][0] = 0xd8; k[8][1] = 0x07; k[8][2] = 0xaa; k[8][3] = 0x98;
    k[9][0] = 0x12; k[9][1] = 0x83; k[9][2] = 0x5b; k[9][3] = 0x01;
    k[10][0] = 0x24; k[10][1] = 0x31; k[10][2] = 0x85; k[10][3] = 0xbe;
    k[11][0] = 0x55; k[11][1] = 0x0c; k[11][2] = 0x7d; k[11][3] = 0xc3;
    k[12][0] = 0x72; k[12][1] = 0xbe; k[12][2] = 0x5d; k[12][3] = 0x74;
    k[13][0] = 0x80; k[13][1] = 0xde; k[13][2] = 0xb1; k[13][3] = 0xfe;
    k[14][0] = 0x9b; k[14][1] = 0xdc; k[14][2] = 0x06; k[14][3] = 0xa7;
    k[15][0] = 0xc1; k[15][1] = 0x9b; k[15][2] = 0xf1; k[15][3] = 0x74;
    k[16][0] = 0xe4; k[16][1] = 0x9b; k[16][2] = 0x69; k[16][3] = 0xc1;
    k[17][0] = 0xef; k[17][1] = 0xbe; k[17][2] = 0x47; k[17][3] = 0x86;
    k[18][0] = 0x0f; k[18][1] = 0xc1; k[18][2] = 0x9d; k[18][3] = 0xc6;
    k[19][0] = 0x24; k[19][1] = 0x0c; k[19][2] = 0xa1; k[19][3] = 0xcc;
    k[20][0] = 0x2d; k[20][1] = 0xe9; k[20][2] = 0x2c; k[20][3] = 0x6f;
    k[21][0] = 0x4a; k[21][1] = 0x74; k[21][2] = 0x84; k[21][3] = 0xaa;
    k[22][0] = 0x5c; k[22][1] = 0xb0; k[22][2] = 0xa9; k[22][3] = 0xdc;
    k[23][0] = 0x76; k[23][1] = 0xf9; k[23][2] = 0x88; k[23][3] = 0xda;
    k[24][0] = 0x98; k[24][1] = 0x3e; k[24][2] = 0x51; k[24][3] = 0x52;
    k[25][0] = 0xa8; k[25][1] = 0x31; k[25][2] = 0xc6; k[25][3] = 0x6d;
    k[26][0] = 0xb0; k[26][1] = 0x03; k[26][2] = 0x27; k[26][3] = 0xc8;
    k[27][0] = 0xbf; k[27][1] = 0x59; k[27][2] = 0x7f; k[27][3] = 0xc7;
    k[28][0] = 0xc6; k[28][1] = 0xe0; k[28][2] = 0x0b; k[28][3] = 0xf3;
    k[29][0] = 0xd5; k[29][1] = 0xa7; k[29][2] = 0x91; k[29][3] = 0x47;
    k[30][0] = 0x06; k[30][1] = 0xca; k[30][2] = 0x63; k[30][3] = 0x51;
    k[31][0] = 0x14; k[31][1] = 0x29; k[31][2] = 0x29; k[31][3] = 0x67;
    k[32][0] = 0x27; k[32][1] = 0xb7; k[32][2] = 0x0a; k[32][3] = 0x85;
    k[33][0] = 0x2e; k[33][1] = 0x1b; k[33][2] = 0x21; k[33][3] = 0x38;
    k[34][0] = 0x4d; k[34][1] = 0x2c; k[34][2] = 0x6d; k[34][3] = 0xfc;
    k[35][0] = 0x53; k[35][1] = 0x38; k[35][2] = 0x0d; k[35][3] = 0x13;
    k[36][0] = 0x65; k[36][1] = 0x0a; k[36][2] = 0x73; k[36][3] = 0x54;
    k[37][0] = 0x76; k[37][1] = 0x6a; k[37][2] = 0x0a; k[37][3] = 0xbb;
    k[38][0] = 0x81; k[38][1] = 0xc2; k[38][2] = 0xc9; k[38][3] = 0x2e;
    k[39][0] = 0x92; k[39][1] = 0x72; k[39][2] = 0x2c; k[39][3] = 0x85;
    k[40][0] = 0xa2; k[40][1] = 0xbf; k[40][2] = 0xe8; k[40][3] = 0xa1;
    k[41][0] = 0xa8; k[41][1] = 0x1a; k[41][2] = 0x66; k[41][3] = 0x4b;
    k[42][0] = 0xc2; k[42][1] = 0x4b; k[42][2] = 0x8b; k[42][3] = 0x70;
    k[43][0] = 0xc7; k[43][1] = 0x6c; k[43][2] = 0x51; k[43][3] = 0xa3;
    k[44][0] = 0xd1; k[44][1] = 0x92; k[44][2] = 0xe8; k[44][3] = 0x19;
    k[45][0] = 0xd6; k[45][1] = 0x99; k[45][2] = 0x06; k[45][3] = 0x24;
    k[46][0] = 0xf4; k[46][1] = 0x0e; k[46][2] = 0x35; k[46][3] = 0x85;
    k[47][0] = 0x10; k[47][1] = 0x6a; k[47][2] = 0xa0; k[47][3] = 0x70;
    k[48][0] = 0x19; k[48][1] = 0xa4; k[48][2] = 0xc1; k[48][3] = 0x16;
    k[49][0] = 0x1e; k[49][1] = 0x37; k[49][2] = 0x6c; k[49][3] = 0x08;
    k[50][0] = 0x27; k[50][1] = 0x48; k[50][2] = 0x77; k[50][3] = 0x4c;
    k[51][0] = 0x34; k[51][1] = 0xb0; k[51][2] = 0xbc; k[51][3] = 0xb5;
    k[52][0] = 0x39; k[52][1] = 0x1c; k[52][2] = 0x0c; k[52][3] = 0xb3;
    k[53][0] = 0x4e; k[53][1] = 0xd8; k[53][2] = 0xaa; k[53][3] = 0x4a;
    k[54][0] = 0x5b; k[54][1] = 0x9c; k[54][2] = 0xca; k[54][3] = 0x4f;
    k[55][0] = 0x68; k[55][1] = 0x2e; k[55][2] = 0x6f; k[55][3] = 0xf3;
    k[56][0] = 0x74; k[56][1] = 0x8f; k[56][2] = 0x82; k[56][3] = 0xee;
    k[57][0] = 0x78; k[57][1] = 0xa5; k[57][2] = 0x63; k[57][3] = 0x6f;
    k[58][0] = 0x84; k[58][1] = 0xc8; k[58][2] = 0x78; k[58][3] = 0x14;
    k[59][0] = 0x8c; k[59][1] = 0xc7; k[59][2] = 0x02; k[59][3] = 0x08;
    k[60][0] = 0x90; k[60][1] = 0xbe; k[60][2] = 0xff; k[60][3] = 0xfa;
    k[61][0] = 0xa4; k[61][1] = 0x50; k[61][2] = 0x6c; k[61][3] = 0xeb;
    k[62][0] = 0xbe; k[62][1] = 0xf9; k[62][2] = 0xa3; k[62][3] = 0xf7;
    k[63][0] = 0xc6; k[63][1] = 0x71; k[63][2] = 0x78; k[63][3] = 0xf2;
    Last edited by CriscoCube; 03-20-2011 at 10:13 PM. Reason: added content

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    The only thing you need to change in that code to make it C, is to change your array declarations.

    From:
    Code:
    int[64][4] k;
    int[8][4] init;
    To:
    Code:
    int k[64][4];
    int init[8][4];
    If you understand what you're doing, you're not learning anything.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Moved to correct forum.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. help needed with edit control & encryption
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2006, 08:21 PM
  3. abt encryption algorithm
    By purIn in forum C Programming
    Replies: 9
    Last Post: 12-22-2003, 10:16 PM
  4. What's wrong with my Stream Cipher Encryption?
    By Davros in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2002, 09:51 PM
  5. File Encryption & Read/Write in Binary Mode
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 06:45 PM