Kryptauksesta

Seuraa 
Viestejä45973
Liittynyt3.9.2015

Joo, joskus tuli fundeerattua muun ohessa vuosikymmenen tehokasta kryptausta, sellaista jota ei avata. Ohessa on peruskoodimössö. Olkoon pakattava data triviaalisti ensin:

[code:39bwy777]uint8 information[256]=
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};[/code:39bwy777]
Salauksen tulos on silloin heksana:

[code:39bwy777]eb1790f417b79fe31044b61415a33ea4faf3d282f3f3a621cfac18b69c9c993b86888e4f37c161ce
e1896ba8fffbefc97746ccc43c26c0ad09107cb1635ae68fecaaf5fa296692b42819e4f2ea2dd2be
3f1ee68ce072ad4e2a2ec564b92da266a9d8a3dd0a5f0a8e8c6f2dfacab67a0d3a3617400db58cd6
5c399a5095dfaa99c4aada3cfdbe4e408826804e152103d779cd33f02914b905eb8a683013f5c8fe
c87d800eb8202343e9e39c5dd61c5a1c7b2f1b788e542a54c3d01f249a9458700fef8db169a4b2e3
ec3cc1a8f8daca96e99881ad28b15f1bc77fe046a425f5fde223ad1d86b720aaf4b83dd1f78a9729
5d853ca0a8b8418b7b75aa47ca627fa7964a94bf4b7c9dc5290995bff2d8e95009ba6cc6ed620768
c6999831ae220beb8d76accab9d44fde7fd5777043c67811d9df1ceac2a05601864fbb23c9e97816
e46b5c6cd62d1833715b61f985a5be13f2bc4107b2d8aa73f367fe7d13df1dd9f0f40235f7f8249c
12718fc26728246f10397f1bb352a7bd4b951dffb85cbacd67f8180a327109d6873737f709f7a775
dfdfca0098d9a8b8ce196b2b09292f88461fbbbabd50a363ee2072db155ad73854e4f6dddf6ce53d
b65206dbf3e920b9ff981d8e623e886ff91cfc2887e8109a3fdf32bd5f80ee0cbd80d7916e978301
d6d235a86f6352aaa6d43d3bd43531c16ff05620c71695c3cb650a3a9689aa73[/code:39bwy777]
Esimerkin vuoksi, jos tuo kryptattava data olisi edelleen yhtä mitäänsanomattomasti:

[code:39bwy777]uint8 information[256]=
{
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};[/code:39bwy777]
Silloin tulos olisi yhden bitin erolla edelliseen:

[code:39bwy777]14375842dd0d17f9d78d14b77dd849e32ad9fa0ac9a0f6cd3fbe5365e7363efc1142fbfea118ccf0
71511dbb7d7176d5295a14a2f75904a120c95db302c008d0db2d7fa4123c80a9656aa958bd9d54e3
cd9ba2089573c2f76b234a4bb7e04d09aff24acf47648f30ff7de2c794a5736db849a3fba0213b7f
babfbc5d1dfd9e581cbc29effee38559b0651a25c056599a05e73ae81ca28a0d64cfc2ca691598f6
8d65566402c296b8cc6716aadde0728b011678cc75722bc5f970b32786e14ecfefdb60e2eb275c5d
ded4ede1fba7070dc5264f6679b6918c743424442bc4e38a3fc54e98fc73908f7dafdf9aba3e941e
66fbad7b57644fe660d563b57f7967b7964fe29462082d67f6a16f3dd7ae509aaa9c3f7e4608cb37
e121b07a8c513255e707c3cdac0afb6f2a21b7f4b6d4f9fae8e3cfe3e8b629ba7c9ba79d27ce30b7
25fab04983678032b178fcfdc4f4b96035d765cfc408c9cbc937c34b38ec51682765a7e2ca79ba74
70505d9f9abe5b2324670a47ce44359655f2f4da4cb77ea9f8aaa867449324158ab2720da868917a
a00586bb03b4326315ba60b9c03b3b30e0ef696b36d5590f01cc7573f4ab7be6d8622028ae58f081
03ae8cc4ae6c3678741d3e31f9f85de331a4f8cdf3f9081edc7f7b9ee651948aa4921e9a4071e9d6
8229874aaa707bf6e578db17c24642b81a56b3aa74daef97a5ddb550cb242bf9[/code:39bwy777]
En sitten viitsinyt fundeerata enää julkisen ja yksityisen avaimen tuomaa lisähelppoutta, mutta tuossa moniulotteisen algebran fraktaaliharmoniassa olisi melko helppo ratkaisu. Varmaan niihin alkulukuihin perustuvat salausmetodit ovat vielä pitkään cool, mutta jossain vaiheessa tulevaisuudessa kaaos ajaa edelle, mene ja tiedä.

[code:39bwy777]#include
#include
#include

typedef signed char int8;
typedef unsigned char uint8;

class LifeRnd256
{
public:

long rnd(void);
~LifeRnd256(void);
LifeRnd256(long *key);
void setNewCycle(long c4);

private:

uint8 *a, *b;
uint8 *c, *d;
uint8 abcd[4];
long life[256];
void inc4(void);
void setUp(void);
};

LifeRnd256::~LifeRnd256(void)
{
}

void LifeRnd256::setUp(void)
{
int i, j;
uint8 tmp[1024];
uint8 *f=(uint8*)life;
uint8 Crc8(uint8*, unsigned);

for (i=0; i<4; i++)
{
for (j=0; j<1024; j++)
{
tmp[j]=f[i^j];
}
abcd[i]=Crc8(tmp, 1024);
}

for (i=0; i<256; i+=1)
life[i]+=*(long*)abcd;

for (i=0; i<4; i++)
abcd[i] = (uint8)i;
}

LifeRnd256::LifeRnd256(long *avain)
{
int n=sizeof(long)*256;
memcpy(life, avain, n);
a = abcd+0; b = abcd+1;
c = abcd+2; d = abcd+3;
setUp(/* CRC-square */);
}

void LifeRnd256::inc4(void)
{
int i=3;
uint8 t=1;

while (i >= 0)
{
if (!(abcd[i]+=t)) --i;
else if ((++i)==4) return;
else abcd[i]=abcd[i-1];
}

for (i=0; i<4; i++)
abcd[i] = (uint8)i;
}

inline long LifeRnd256::rnd(void)
{
life[*a]+=(life[*a]>>16)^(life[*b]<<16);
life[*b]+=(life[*a]<<16)^(life[*b]>>16);

life[*a]+=life[*c];
life[*b]-=life[*d];

inc4(); /* 174 792 640 */
return life[*a]^life[*b];
}

void LifeRnd256::setNewCycle(long crc)
{
for (int i=0x00; i<256; i++)
life[i]+=crc; /* from src */
}

inline void swap(int &a, int &b)
{
int c=a; a=b; b=c;
}

inline void setBit(uint8 *a, int i)
{
a[i>>3]|=(uint8)(1<<(i&7));
}

inline void clrBit(uint8 *a, int i)
{
a[i>>3]&=(uint8)~(1<<(i&7));
}

inline int testBit(uint8 *a, int i)
{
return a[i>>3]&(uint8)(1<<(i&7))? 1: 0;
}

uint8 Crc8(uint8 *data, unsigned len)
{
static const uint8 ParityBit[256]=
{
0x00, 0x66, 0xcc, 0xaa, 0x87, 0xe1, 0x4b, 0x2d,
0x11, 0x77, 0xdd, 0xbb, 0x96, 0xf0, 0x5a, 0x3c,
0x22, 0x44, 0xee, 0x88, 0xa5, 0xc3, 0x69, 0x0f,
0x33, 0x55, 0xff, 0x99, 0xb4, 0xd2, 0x78, 0x1e,
0x44, 0x22, 0x88, 0xee, 0xc3, 0xa5, 0x0f, 0x69,
0x55, 0x33, 0x99, 0xff, 0xd2, 0xb4, 0x1e, 0x78,
0x66, 0x00, 0xaa, 0xcc, 0xe1, 0x87, 0x2d, 0x4b,
0x77, 0x11, 0xbb, 0xdd, 0xf0, 0x96, 0x3c, 0x5a,
0x88, 0xee, 0x44, 0x22, 0x0f, 0x69, 0xc3, 0xa5,
0x99, 0xff, 0x55, 0x33, 0x1e, 0x78, 0xd2, 0xb4,
0xaa, 0xcc, 0x66, 0x00, 0x2d, 0x4b, 0xe1, 0x87,
0xbb, 0xdd, 0x77, 0x11, 0x3c, 0x5a, 0xf0, 0x96,
0xcc, 0xaa, 0x00, 0x66, 0x4b, 0x2d, 0x87, 0xe1,
0xdd, 0xbb, 0x11, 0x77, 0x5a, 0x3c, 0x96, 0xf0,
0xee, 0x88, 0x22, 0x44, 0x69, 0x0f, 0xa5, 0xc3,
0xff, 0x99, 0x33, 0x55, 0x78, 0x1e, 0xb4, 0xd2,
0x0f, 0x69, 0xc3, 0xa5, 0x88, 0xee, 0x44, 0x22,
0x1e, 0x78, 0xd2, 0xb4, 0x99, 0xff, 0x55, 0x33,
0x2d, 0x4b, 0xe1, 0x87, 0xaa, 0xcc, 0x66, 0x00,
0x3c, 0x5a, 0xf0, 0x96, 0xbb, 0xdd, 0x77, 0x11,
0x4b, 0x2d, 0x87, 0xe1, 0xcc, 0xaa, 0x00, 0x66,
0x5a, 0x3c, 0x96, 0xf0, 0xdd, 0xbb, 0x11, 0x77,
0x69, 0x0f, 0xa5, 0xc3, 0xee, 0x88, 0x22, 0x44,
0x78, 0x1e, 0xb4, 0xd2, 0xff, 0x99, 0x33, 0x55,
0x87, 0xe1, 0x4b, 0x2d, 0x00, 0x66, 0xcc, 0xaa,
0x96, 0xf0, 0x5a, 0x3c, 0x11, 0x77, 0xdd, 0xbb,
0xa5, 0xc3, 0x69, 0x0f, 0x22, 0x44, 0xee, 0x88,
0xb4, 0xd2, 0x78, 0x1e, 0x33, 0x55, 0xff, 0x99,
0xc3, 0xa5, 0x0f, 0x69, 0x44, 0x22, 0x88, 0xee,
0xd2, 0xb4, 0x1e, 0x78, 0x55, 0x33, 0x99, 0xff,
0xe1, 0x87, 0x2d, 0x4b, 0x66, 0x00, 0xaa, 0xcc,
0xf0, 0x96, 0x3c, 0x5a, 0x77, 0x11, 0xbb, 0xdd,
};

unsigned i;
unsigned tmp8;
unsigned crc=0xff;

for (i=0; i
{
tmp8=data[i]^crc;
crc=tmp8^ParityBit[tmp8];
}

return (uint8)crc;
}

void Encrypt(uint8 *dst, uint8 *src, long *avain)
{
uint8 tmp[256];
int hide[4096];
int i, j, x, y;
long crc4ofSrc;

long *f128=(long*)dst;
LifeRnd256 inf(avain);
memcpy(dst, src, 256);

for (i=0; i<256; i++)
{
for (j=0; j<256; j++)
tmp[j]=(uint8)src[i^j];
dst[256+i]=Crc8(tmp, 256);
}

for (i=0; i<4096; i++)
hide[i]=i; /* ----- */

for (i=0; i<4096; i++)
{
x=(int)inf.rnd()&0xfff;
y=(int)inf.rnd()&0xfff;
swap(hide[x], hide[y]);
}

uint8 *c4=(uint8*)&crc4ofSrc;
crc4ofSrc=*(long*)(dst+256);
inf.setNewCycle(crc4ofSrc);

for (i=0; i<2048; i++)
{
if (testBit(src, i)) setBit(dst, hide[i]);
else /* --------- */ clrBit(dst, hide[i]);
}

for (i=0; i<128; i++)
f128[i]^=0x55555555L;

for (i=0; i<512; i++)
{
j=(int)inf.rnd()&127;
f128[j] ^= inf.rnd();
}

for (i=0; i<32; i++)
{
if (testBit(c4, i)) setBit(dst, hide[2048+i]);
else /* -------- */ clrBit(dst, hide[2048+i]);
}
}

void Decrypt(uint8 *dst, uint8 *src, long *avain)
{
int hide[4096];
int i, j, x, y;
uint8 c4[0x04];

long *f128=(long*)dst;
LifeRnd256 inf(avain);
for (i=0; i<4096; i++)
hide[i]=i; /* ----- */

for (i=0; i<4096; i++)
{
x=(int)inf.rnd()&0xfff;
y=(int)inf.rnd()&0xfff;
swap(hide[x], hide[y]);
}

for (i=0; i<32; i++)
{
if (testBit(dst, hide[2048+i])) setBit(c4, i);
else /* -------------------- */ clrBit(c4, i);
}

inf.setNewCycle(*(long*)c4);

for (i=0; i<512; i++)
{
j=(int)inf.rnd()&127;
f128[j] ^= inf.rnd();
}

for (i=0; i<128; i++)
f128[i]^=0x55555555L;

for (i=0; i<2048; i++)
{
if (testBit(dst, hide[i])) setBit(src, i);
else /* --------------- */ clrBit(src, i);
}
}

void main(void)
{
long key[256]=
{
0x1935f4dfL, 0xcf745790L, 0xc4d3f7bbL, 0x1161a60dL,
0x3a0b8bc8L, 0x883cc23fL, 0x3676535eL, 0x72989197L,
0x80eb8a3aL, 0xd5fd72a7L, 0x74ba2922L, 0x49f377a3L,
0xb592209dL, 0xda157096L, 0xfaa6d72cL, 0xb778f819L,
0x136d885cL, 0x8bcc80aeL, 0x417fe363L, 0x4f80b6eaL,
0x431fb8b4L, 0xfdac2702L, 0xda4ebb69L, 0x3c002a4fL,
0xc3465e5aL, 0xe1aa284bL, 0x5363a7a8L, 0x6bdb68c1L,
0x48fa8cf8L, 0x59818937L, 0x1a71a354L, 0xc7e7df19L,
0x41b41329L, 0x554f5382L, 0x21b65363L, 0xbdd12730L,
0xa0832abfL, 0xd7834127L, 0x4738fb70L, 0x66a35d21L,
0x322c08d2L, 0xdd43f192L, 0xf3f122deL, 0x26922f58L,
0xd725f737L, 0xe5051232L, 0x585fbc77L, 0x06b4c0baL,
0x820b2664L, 0x3ffe79efL, 0xac9d32bfL, 0x52aa79efL,
0x2bc26b95L, 0x24473e3aL, 0xa141804cL, 0xa938a51cL,
0x8adf6074L, 0x4581ea07L, 0xdd948b12L, 0xfa2a52bbL,
0x303d76afL, 0x0cd40812L, 0x7c4a52b7L, 0xdc5b31c2L,
0x50701827L, 0x004f76beL, 0x003025b5L, 0x6f299d1eL,
0x0ce5824aL, 0x8ee3237eL, 0x02aec994L, 0xab100f73L,
0xb2dce46fL, 0x3abb44eaL, 0xefdb4f1dL, 0x7283a859L,
0xe173c7d3L, 0x55452103L, 0x0c40e18eL, 0x1e9d7d29L,
0x43e5b091L, 0xa64d6eabL, 0xca842fecL, 0x0ae63d3bL,
0x9a0d415dL, 0x15f38535L, 0x2c2a1248L, 0xef84fa58L,
0xd6c0750aL, 0x1a4428c6L, 0x2c8f83d1L, 0x849094e3L,
0x6334fb0aL, 0xa2be9201L, 0xfd1d64acL, 0x6b03da05L,
0xdc481a78L, 0x522a62caL, 0x456e5946L, 0x4ba4f949L,
0x72b697c0L, 0xb7b27b6eL, 0x58f7ac60L, 0x79e84c3bL,
0x6ed214dcL, 0xe82b7ce5L, 0x611e5f08L, 0xfdc3d2f7L,
0xe21ed654L, 0x5ce7ce25L, 0x24b31c57L, 0xb13dad7aL,
0xc8dd0927L, 0xbd402010L, 0x398f268eL, 0x398fed7fL,
0x4b375398L, 0xf12078d4L, 0x6a70f5d2L, 0x3f122e47L,
0x6f0957edL, 0xf64ead0dL, 0x5b10b4baL, 0x87ef4f90L,
0x5de4f9d6L, 0x82a7895cL, 0x3339f4c0L, 0x986819e8L,
0x80073544L, 0x21e12fc0L, 0xfaeb0ba6L, 0x7c7eab98L,
0xf272837eL, 0xb9f48b3eL, 0xf707f16dL, 0x1fc64046L,
0x4f1267a9L, 0x9818b69bL, 0x7634a635L, 0x081e6356L,
0xc5bbe582L, 0xa0fd437dL, 0x574fa287L, 0x08156141L,
0x0ec4bd22L, 0x851b0048L, 0x6678d01dL, 0xb5dd6eecL,
0x0b5f0e78L, 0x8080c224L, 0x55477c88L, 0xb5cfc2d9L,
0x32d98e63L, 0x992407cfL, 0xe40c61fbL, 0x382e7ff2L,
0xe186392dL, 0x0b7db079L, 0x5d5a81dbL, 0xa62c171fL,
0x576e8615L, 0x09dfdd06L, 0x8e8bc416L, 0x5dca9fd9L,
0x9e120ec2L, 0x2eaebb32L, 0x6f86b35aL, 0x7b74ecc8L,
0xd2a060b6L, 0x0581b253L, 0xc942bb83L, 0x89bf4aadL,
0x1f6032f7L, 0x44579f5fL, 0x76fe70d2L, 0xc898106fL,
0xd4c67731L, 0x72eda4e1L, 0x725b0b00L, 0x21c338bcL,
0x549f0ce3L, 0x19a1c364L, 0x26ad6920L, 0x47b8d3eeL,
0xcf35607bL, 0xf14d8147L, 0x5c11ed77L, 0xc3178933L,
0x9ca7a659L, 0xc68aa9ccL, 0xd4af92b7L, 0x6c5a1383L,
0x1db9c268L, 0xe24b1ec8L, 0x4e324d06L, 0x8a61debbL,
0x84ac3f42L, 0xc8549801L, 0x84297683L, 0x835df3f7L,
0x5cbf3b64L, 0xc4aae49dL, 0xfed5a37cL, 0xb0a60c6cL,
0x3bc33d32L, 0xb671c94cL, 0x917eee23L, 0xc9b598eaL,
0xc3e6ae7aL, 0xf7492308L, 0xcef97c63L, 0x636f206bL,
0x73b7c5f8L, 0x13687bffL, 0x298f08f8L, 0x65dfe5beL,
0x1f732af2L, 0x243813e7L, 0x2a549259L, 0xb9e3b912L,
0xb5ccad60L, 0x440c89fbL, 0xc5a640a5L, 0x1a241bc4L,
0xfa11743aL, 0x8b769f79L, 0xc6d05338L, 0xe5f9f615L,
0x71c9270eL, 0xafcc9603L, 0xb6c543cdL, 0xd81ff736L,
0xffaf566dL, 0x1707ab2dL, 0x9e43ade5L, 0x2b98a54fL,
0x453cb460L, 0x4d375d6aL, 0xf73afbfcL, 0xb66ffe39L,
0xbfa3940fL, 0x020577fbL, 0xd6d28bfbL, 0x7de8b197L,
0xa1eef1e6L, 0x450d00beL, 0xe306f6c5L, 0x0be4da69L,
0x7618708bL, 0xad3d5ffdL, 0xe510f167L, 0x8a557142L,
0x67139054L, 0x4980fe83L, 0x90bbda1fL, 0x99d088c5L,
};

uint8 information[256]=
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};

uint8 encrypt[512];

for (int i=0; i<256; i++)
{
printf("%02x", (unsigned)information[i]);
}
printf("\n\n");

Encrypt(encrypt, information, key);

for (int i=0; i<512; i++)
{
printf("%02x", (unsigned)encrypt[i]);
}
printf("\n\n");

memset(information, 0, sizeof(uint8)*256);

Decrypt(encrypt, information, key);

for (int i=0; i<256; i++)
{
printf("%02x", (unsigned)information[i]);
}
printf("\n\n");
}[/code:39bwy777]

Kommentit (2)

Vierailija

Ei kyllä aivan kaikki mennyt jakeluun. Lyhyesti tuota koodia kokeilin. Jos kryptattava data olisi:

[code:3j0d1ulb]uint8 information[256]=
{
't','o','r','s','t','a','i',' ','o','n',' ','h','y','v','i','n',
' ','v','i','h','a','i','n','e','n','o','r','s','t','a','i',' ',
'o','n',' ','h','y','v','i','n',' ','v','i','h','a','i','n','e',
'n','t','r','s','t','a','i',' ','o','n',' ','h','y','v','i','n',
' ','v','i','h','a','i','n','e','n','t','o','s','t','a','i',' ',
'o','n',' ','h','y','v','i','n',' ','v','i','h','a','i','n','e',
'n','t','o','r','t','a','i',' ','o','n',' ','h','y','v','i','n',
' ','v','i','h','a','i','n','e','n','t','o','r','s','a','i',' ',
'o','n',' ','h','y','v','i','n',' ','v','i','h','a','i','n','e',
'n','t','o','r','s','t','i',' ','o','n',' ','h','y','v','i','n',
' ','v','i','h','a','i','n','e','n','t','o','r','s','t','a',' ',
'o','n',' ','h','y','v','i','n',' ','v','i','h','a','i','n','e',
'n','t','o','r','s','t','a','i','o','n',' ','h','y','v','i','n',
' ','v','i','h','a','i','n','e','n','t','o','r','s','t','a','i',
' ','n',' ','h','y','v','i','n',' ','v','i','h','a','i','n','e',
'n','t','o','r','s','t','a','i',' ','o',' ','h','y','v','i','n',
};[/code:3j0d1ulb]

Ja merkit tulostetaan mainissa merkkeinä, tuosta salauksesta näyttäisi palautuvan alkuperäinen data, kuten varmaan pitääkin. Seuraavassa testimainin tulostama litania:

[code:3j0d1ulb]torstai on hyvin vihainenorstai on hyvin vihainentrstai on hyvin vihainentostai
on hyvin vihainentortai on hyvin vihainentorsai on hyvin vihainentorsti on hyvin
vihainentorsta on hyvin vihainentorstaion hyvin vihainentorstai n hyvin vihaine
ntorstai o hyvin

80166514f334575dbc6a74aa2fd87c8e95f8d11cb4315d7cab5335e2f356657d510876baca4d8f30
a59beca205f2cb145d81bf048a72a8c58aaf1b884cf1a0f4f5e10d0d6fdf94388d6b9d5916c3e904
b4276ceb26a414bffecc425f49e1dceb0bb9e524a91d0fd21260a4935e9db6d53c40feb9358d2eac
b4903a7aa65360f14159665ef7c06492e65bd6138b8aa7f303e357da9892aff805ea6536023ab731
6f56c3860a5a58f29c55ff96e01fbe024b4710d64f5e139b67ce899780fda69077eb81b4ba23f202
3b21a5ce2464942132a7ae128a9d619adef30701f96c83301e0992008a9791bdf70ef412f2aed089
70affee043d0992f1e834f3532fa9a4553de7617dfad542158d85939b8c98ab20bff16fd6d56efa4
0a862525722b43664576dc1b86884c211c0eab39d7831c147d4a083de288e35a3dff09beff9c854a
29fbc6d974dcc452e608da044fc8f2423b57baf89f991624aeb820e456d52d91795730a96cf5c980
850d898265d2d4ff86334567319c9746147294f5c233266b43a46c3731032ecfb4cb477e621d0576
c7498dd6aa30754f996c11f3c8ba319570d0d27d3326f4e24ccc7f317e08cd8003ec5a821a8ddf8f
89ce941ce78efd1fe3dbd4a0fee1ccd6cbecc502351f58f914cb7d9b0993ab7cd2aeba78694140d6
854ffea8b91f29fac7620af5f67d183c96585b42f229bcdf3ad12444a7f9ed04

torstai on hyvin vihainenorstai on hyvin vihainentrstai on hyvin vihainentostai
on hyvin vihainentortai on hyvin vihainentorsai on hyvin vihainentorsti on hyvin
vihainentorsta on hyvin vihainentorstaion hyvin vihainentorstai n hyvin vihaine
ntorstai o hyvin[/code:3j0d1ulb]

Jos ymmärsin oikein, algoritmi ymppää kryptattavan datan oheen yhtä monta feikkibittiä. Avaimessa on näemmä 8192 bittiä. Koodin perusteella se voisi olla ilmeisesti n-bittiäkin. Kannattaisi kuitenkin palata piirustuspöydän ääreen ja tehdä se julkisen ja yksityisen avaimen lisä, niin olisi mukava vain nähdä ainakin osittain fraktaaleihin perustuva salausmetodi.

-torstai

Vierailija

Varmaan niin. Mutta tuon algoritmin hauskuus on siinä, että avaimen jokainen bitti peittää kryptatun datan omalla bittimössöllään. Jos tuossa sun esimerkissäsi koruptoi avaimesta yhden bitin, lopputuloksena on mitäänsanomaton kaaos.

[code:oncqehw0]torstai on hyvin vihainenorstai on hyvin vihainentrstai on hyvin vihainentostai
on hyvin vihainentortai on hyvin vihainentorsai on hyvin vihainentorsti on hyvin
vihainentorsta on hyvin vihainentorstaion hyvin vihainentorstai n hyvin vihaine
ntorstai o hyvin

80166514f334575dbc6a74aa2fd87c8e95f8d11cb4315d7cab5335e2f356657d510876baca4d8f30
a59beca205f2cb145d81bf048a72a8c58aaf1b884cf1a0f4f5e10d0d6fdf94388d6b9d5916c3e904
b4276ceb26a414bffecc425f49e1dceb0bb9e524a91d0fd21260a4935e9db6d53c40feb9358d2eac
b4903a7aa65360f14159665ef7c06492e65bd6138b8aa7f303e357da9892aff805ea6536023ab731
6f56c3860a5a58f29c55ff96e01fbe024b4710d64f5e139b67ce899780fda69077eb81b4ba23f202
3b21a5ce2464942132a7ae128a9d619adef30701f96c83301e0992008a9791bdf70ef412f2aed089
70affee043d0992f1e834f3532fa9a4553de7617dfad542158d85939b8c98ab20bff16fd6d56efa4
0a862525722b43664576dc1b86884c211c0eab39d7831c147d4a083de288e35a3dff09beff9c854a
29fbc6d974dcc452e608da044fc8f2423b57baf89f991624aeb820e456d52d91795730a96cf5c980
850d898265d2d4ff86334567319c9746147294f5c233266b43a46c3731032ecfb4cb477e621d0576
c7498dd6aa30754f996c11f3c8ba319570d0d27d3326f4e24ccc7f317e08cd8003ec5a821a8ddf8f
89ce941ce78efd1fe3dbd4a0fee1ccd6cbecc502351f58f914cb7d9b0993ab7cd2aeba78694140d6
854ffea8b91f29fac7620af5f67d183c96585b42f229bcdf3ad12444a7f9ed04

~~~CorruptBit(key, 1);~~~
~~~memset(information, 0, sizeof(uint8)*256);~~~
~~~Decrypt(encrypt, information, key);~~~

└F▀╔¦0←♥♀AÆk6:]W1ú?­0õ▲↓m0j▬$Ý)­¶ØúåÈYû
→á∟ · _Ë/←¦ï☻¬)┼╚▒Ã↓pª♠ÀHgm`▀jé3U!ñ♠▄Zãu♠►é¶+x}┬ëÏÜè|Rà╚úJç­<⌂±Û═ .░Ü&å♣=d╚═~ü┤
SYÓñÿ§¢·ôç !,▬∟×<┘♦ýA³´îÒ8‼{→eÆÀ↕╝╚i←¥qàa ZOA┬♥▼6´6ÿ┬6.l♂ã☼ÖÂË♣*Bè(íWd↓←%È
♥1¶Té~>┐L
£╣¼Ï
┼☻cÏ®vE³ÄæÑÔ§.↕F→░ª\ -î╚&ÃSÖùnÙð~]↕'aí׬ ►4[/code:oncqehw0]

[code:oncqehw0]void CorruptBit(void *block, int bitNro)
{
uint8 *a=(uint8*)block;
if (testBit(a, bitNro)) clrBit(a, bitNro);
else /* ------------ */ setBit(a, bitNro);
}[/code:oncqehw0]
Niin, että avainta ei voi lähestyä iteratiivisin menetelmin, vaan sen kaikki bitit ovat merkitseviä. Erilaisia avaimia saa siis plarata likimain 10^2466 tapausta. Avain voi myös olla ajonaikainen ja riippua siitä, miten fraktaaliavain sopii sitä vastaavaan fraktaalilukkoon, joka entisestään lisäisi plarattavia tapauksia.

Tiedä häntä. Voisihan tuota julkisen ja yksityisen fraktaaliavaimen tekniikkaa joskus katsoa, kun ei ole tähdellisempää customointia.

Uusimmat

Suosituimmat