#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int i, x, chr;
int tab[] = {106, 123, 238, 135, 24, 107, 194, 195, 158, 80, 136, 91, 81, 168, 227, 174, 22, 44, 73, 26, 131, 219, 105, 15, 129, 62, 221, 32, 191, 10, 170, 171, 233, 180, 28, 8, 5, 98, 240, 149, 176, 95, 199, 16, 60, 113, 228, 118, 11, 109, 9, 127, 177, 115, 93, 41, 205, 250, 75, 218, 49, 7, 220, 193, 90, 155, 188, 1, 145, 254, 35, 241, 20, 247, 27, 46, 175, 86, 84, 159, 248, 222, 237, 160, 71, 103, 117, 165, 161, 17, 236, 139, 151, 99, 57, 217, 54, 42, 40, 89, 153, 83, 201, 209, 156, 104, 78, 19, 33, 167, 111, 154, 55, 121, 239, 230, 66, 190, 47, 65, 70, 235, 164, 137, 210, 101, 231, 112, 148, 200, 134, 225, 77, 92, 198, 242, 197, 88, 172, 147, 67, 122, 36, 72, 69, 138, 211, 76, 252, 223, 186, 82, 163, 152, 202, 96, 31, 207, 214, 108, 58, 249, 85, 34, 68, 189, 23, 245, 48, 213, 157, 184, 12, 133, 39, 212, 179, 162, 14, 144, 30, 2, 234, 166, 25, 97, 53, 224, 43, 50, 185, 246, 94, 203, 59, 206, 13, 37, 187, 6, 178, 169, 216, 208, 21, 130, 61, 126, 3, 150, 226, 140, 232, 244, 251, 143, 125, 100, 229, 63, 120, 74, 173, 52, 128, 196, 146, 132, 192, 29, 141, 204, 124, 45, 4, 110, 243, 51, 255, 114, 87, 64, 102, 142, 181, 215, 183, 116, 182, 56, 38, 119, 253, 18, 79};
unsigned char text[6] = "hallo",
enkodiert[6],
dekodiert[6];
for (i = 0; i < sizeof(text); i++) {
enkodiert[i] = (unsigned char)tab[(int)text[i]];
}
for (i = 0; i < sizeof(enkodiert); i++) {
for (x = 0; x < 255; x++) {
if (tab[x] == (int)enkodiert[i]) {
dekodiert[i] = (unsigned char)x;
break;
}
}
}
cout << "Text: " << dekodiert << "\n";
system("PAUSE");
return 0;
}