|
|
|
 |
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


|
 |
 |
 |
|
|
|
|
|
|
|