Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Community Calendar Today's Posts Search
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > The Lounge

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next

 
Reply
Posted 2007-04-25, 01:14 PM in reply to !King_Amazon!'s post "Encrypted Thread, Part 2"
Here's the code I came up with for the cipher, I challenge anyone to break our messages.

Code:
static unsigned char etab[256];
static unsigned char tp;

unsigned char genrand();

void setkey(unsigned char *key, int length, unsigned char *iv)
{
    int i;
    for(i = 0; i < 256; i++) {
        etab[i] = i + key[i % length] + length ^ iv[i];
    }
    tp = 0;
    for(i = 0; i < 256; i++) {
       genrand();
    }
}

#define R_ROT(n, r) (((n) >> (r)) | ((n) << (8-(r))))
#define F(x) ((((x) * (x)) << 1) | 1)
unsigned char genrand()
{
    unsigned char r0, r1, k0, k1, k2;

    k0 = etab[tp] + 0x6a;
    k1 = etab[(tp + 1) & 0xff] + 0xf1;
    k2 = etab[(tp + 2) & 0xff] + 0x29;

    r0 = etab[(tp + 3) & 0xff];
    r1 = etab[(tp + 4) & 0xff];

    r0 = R_ROT(r0 ^ r1, F(k1 + r1)) + k0;
    r1 = R_ROT(r1 ^ r0, F(k0 + r0)) + k1 + k0;
    r0 = R_ROT(r0 ^ r1, F(k1 + r1)) + k2;

    tp += 2;

    etab[tp] ^= r1;
    etab[(tp + 1) & 0xff] ^= r0;

    return r0 + r1;
}
#undef R_ROT
#undef F
The code calls setkey with a zero'd iv and with our password. genrand() is then used to XOR our original message. The message is then converted to hex for the forum to use properly.

980B7671D52358F8590CA7E29BCD41878E9CDEE9AC908D440B AD045D554B2DECEA67415728333CC101BC59EB439F81466FFB 2DA35E84812EB4DED9207BCCABD6B65EA5C4C92F95A2F49915 751D847AE9A198AF1D581D3673DF16AB961C80715EFBD17CAE 6A219B96031647EDF47879
Old
Profile PM WWW Search
Mantralord seldom sees opportunities until they cease to beMantralord seldom sees opportunities until they cease to beMantralord seldom sees opportunities until they cease to beMantralord seldom sees opportunities until they cease to be
 
 
Mantralord
 



 

Bookmarks

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules [Forum 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 On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 01:07 AM.
'Synthesis 2' vBulletin 3.x styles and 'x79' derivative
by WetWired the Unbound and Chruser
Copyright ©2002-2008 zelaron.com
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.