Flame of Soul
Главная | Регистрация | Вход

Мои записи


Главная » Статьи » Криптография » Реализация шифров

[CPP] DES (Data Encryption Standard)
== Magic Technologic Inc.==
Volume 0x0c, Algoritms 0x01, Phile #0x0a of 0x0f
|=-----------------------------------------------------------------=|
|=-----------------=[ DES - Алгоритм Шифрования ]=-----------------=|
|=-----------------------------------------------------------------=|
|=--------------=[ [Author]: _ aka Flame of Soul_  ]=--------------=|
|=--------------=[ [E-mail]: _ allbasse@yandex.ru  ]=--------------=|
|=-----------------------------------------------------------------=|
|=------------------------=[ May 15 2007 ]=------------------------=|
|=-----------------------------------------------------------------=|

#define DES_ENCRYPT 1
#define DES_DECRYPT 0
typedef struct deskey
{
unsigned char e[16*8];
unsigned char d[16*8];
unsigned char e2[16*8];
}deskey;
#ifdef DEVICEDRIVER
#pragma VxD_LOCKED_DATA_SEG
#endif
deskey sdisk_des_keys[8];
#if DEVICEDRIVER
#pragma VxD_LOCKED_DATA_SEG
#endif
unsigned long p1[]={
0x00000000,0x00000000,0x01000000,0x00000000,0x00000000,0x01000000,
0x01000000,0x01000000,0x00010000,0x00000000,0x01010000,0x00000000,
0x00010000,0x01000000,0x01010000,0x01000000,0x00000000,0x00010000,
0x01000000,0x00010000,0x00000000,0x01010000,0x01000000,0x01010000,
0x00010000,0x00010000,0x01010000,0x00010000,0x00010000,0x01010000,
0x01010000,0x01010000,0x00000000,0x00000000,0x00000100,0x00000000,
0x00000000,0x00000100,0x00000100,0x00000100,0x00000001,0x00000000,
0x00000101,0x00000000,0x00000001,0x00000100,0x00000101,0x00000100,
0x00000000,0x00000001,0x00000100,0x00000001,0x00000000,0x00000101,
0x00000100,0x00000101,0x00000001,0x00000001,0x00000101,0x00000001,
0x00000001,0x00000101,0x00000101,0x00000101,0x00000000,0x00000000,
0x02000000,0x00000000,0x00000000,0x02000000,0x02000000,0x02000000,
0x00020000,0x00000000,0x02020000,0x00000000,0x00020000,0x02000000,
0x02020000,0x02000000,0x00000000,0x00020000,0x02000000,0x00020000,
0x00000000,0x02020000,0x02000000,0x02020000,0x00020000,0x00020000,
0x02020000,0x00020000,0x00020000,0x02020000,0x02020000,0x02020000,
0x00000000,0x00000000,0x00000200,0x00000000,0x00000000,0x00000200,
0x00000200,0x00000200,0x00000002,0x00000000,0x00000202,0x00000000,
0x00000002,0x00000200,0x00000202,0x00000200,0x00000000,0x00000002,
0x00000200,0x00000002,0x00000000,0x00000202,0x00000200,0x00000202,
0x00000002,0x00000002,0x00000202,0x00000002,0x00000002,0x00000202,
0x00000202,0x00000202,0x00000000,0x00000000,0x04000000,0x00000000,
0x00000000,0x04000000,0x04000000,0x04000000,0x00040000,0x00000000,
0x04040000,0x00000000,0x00040000,0x04000000,0x04040000,0x04000000,
0x00000000,0x00040000,0x04000000,0x00040000,0x00000000,0x04040000,
0x04000000,0x04040000,0x00040000,0x00040000,0x04040000,0x00040000,
0x00040000,0x04040000,0x04040000,0x04040000,0x00000000,0x00000000,
0x00000400,0x00000000,0x00000000,0x00000400,0x00000400,0x00000400,
0x00000004,0x00000000,0x00000404,0x00000000,0x00000004,0x00000400,
0x00000404,0x00000400,0x00000000,0x00000004,0x00000400,0x00000004,
0x00000000,0x00000404,0x00000400,0x00000404,0x00000004,0x00000004,
0x00000404,0x00000004,0x00000004,0x00000404,0x00000404,0x00000404,
0x00000000,0x00000000,0x08000000,0x00000000,0x00000000,0x08000000,
0x08000000,0x08000000,0x00080000,0x00000000,0x08080000,0x00000000,
0x00080000,0x08000000,0x08080000,0x08000000,0x00000000,0x00080000,
0x08000000,0x00080000,0x00000000,0x08080000,0x08000000,0x08080000,
0x00080000,0x00080000,0x08080000,0x00080000,0x00080000,0x08080000,
0x08080000,0x08080000,0x00000000,0x00000000,0x00000800,0x00000000,
0x00000000,0x00000800,0x00000800,0x00000800,0x00000008,0x00000000,
0x00000808,0x00000000,0x00000008,0x00000800,0x00000808,0x00000800,
0x00000000,0x00000008,0x00000800,0x00000008,0x00000000,0x00000808,
0x00000800,0x00000808,0x00000008,0x00000008,0x00000808,0x00000008,
0x00000008,0x00000808,0x00000808,0x00000808,0x00000000,0x00000000,
0x10000000,0x00000000,0x00000000,0x10000000,0x10000000,0x10000000,
0x00100000,0x00000000,0x10100000,0x00000000,0x00100000,0x10000000,
0x10100000,0x10000000,0x00000000,0x00100000,0x10000000,0x00100000,
0x00000000,0x10100000,0x10000000,0x10100000,0x00100000,0x00100000,
0x10100000,0x00100000,0x00100000,0x10100000,0x10100000,0x10100000,
0x00000000,0x00000000,0x00001000,0x00000000,0x00000000,0x00001000,
0x00001000,0x00001000,0x00000010,0x00000000,0x00001010,0x00000000,
0x00000010,0x00001000,0x00001010,0x00001000,0x00000000,0x00000010,
0x00001000,0x00000010,0x00000000,0x00001010,0x00001000,0x00001010,
0x00000010,0x00000010,0x00001010,0x00000010,0x00000010,0x00001010,
0x00001010,0x00001010,0x00000000,0x00000000,0x20000000,0x00000000,
0x00000000,0x20000000,0x20000000,0x20000000,0x00200000,0x00000000,
0x20200000,0x00000000,0x00200000,0x20000000,0x20200000,0x20000000,
0x00000000,0x00200000,0x20000000,0x00200000,0x00000000,0x20200000,
0x20000000,0x20200000,0x00200000,0x00200000,0x20200000,0x00200000,
0x00200000,0x20200000,0x20200000,0x20200000,0x00000000,0x00000000,
0x00002000,0x00000000,0x00000000,0x00002000,0x00002000,0x00002000,
0x00000020,0x00000000,0x00002020,0x00000000,0x00000020,0x00002000,
0x00002020,0x00002000,0x00000000,0x00000020,0x00002000,0x00000020,
0x00000000,0x00002020,0x00002000,0x00002020,0x00000020,0x00000020,
0x00002020,0x00000020,0x00000020,0x00002020,0x00002020,0x00002020,
0x00000000,0x00000000,0x40000000,0x00000000,0x00000000,0x40000000,
0x40000000,0x40000000,0x00400000,0x00000000,0x40400000,0x00000000,
0x00400000,0x40000000,0x40400000,0x40000000,0x00000000,0x00400000,
0x40000000,0x00400000,0x00000000,0x40400000,0x40000000,0x40400000,
0x00400000,0x00400000,0x40400000,0x00400000,0x00400000,0x40400000,
0x40400000,0x40400000,0x00000000,0x00000000,0x00004000,0x00000000,
0x00000000,0x00004000,0x00004000,0x00004000,0x00000040,0x00000000,
0x00004040,0x00000000,0x00000040,0x00004000,0x00004040,0x00004000,
0x00000000,0x00000040,0x00004000,0x00000040,0x00000000,0x00004040,
0x00004000,0x00004040,0x00000040,0x00000040,0x00004040,0x00000040,
0x00000040,0x00004040,0x00004040,0x00004040,0x00000000,0x00000000,
0x80000000,0x00000000,0x00000000,0x80000000,0x80000000,0x80000000,
0x00800000,0x00000000,0x80800000,0x00000000,0x00800000,0x80000000,
0x80800000,0x80000000,0x00000000,0x00800000,0x80000000,0x00800000,
0x00000000,0x80800000,0x80000000,0x80800000,0x00800000,0x00800000,
0x80800000,0x00800000,0x00800000,0x80800000,0x80800000,0x80800000,
0x00000000,0x00000000,0x00008000,0x00000000,0x00000000,0x00008000,
0x00008000,0x00008000,0x00000080,0x00000000,0x00008080,0x00000000,
0x00000080,0x00008000,0x00008080,0x00008000,0x00000000,0x00000080,
0x00008000,0x00000080,0x00000000,0x00008080,0x00008000,0x00008080,
0x00000080,0x00000080,0x00008080,0x00000080,0x00000080,0x00008080,
0x00008080,0x00008080};
unsigned long p2[]={
0x00000000,0x00000000,0x00000040,0x00000000,0x00004000,0x00000000,
0x00004040,0x00000000,0x00400000,0x00000000,0x00400040,0x00000000,
0x00404000,0x00000000,0x00404040,0x00000000,0x40000000,0x00000000,
0x40000040,0x00000000,0x40004000,0x00000000,0x40004040,0x00000000,
0x40400000,0x00000000,0x40400040,0x00000000,0x40404000,0x00000000,
0x40404040,0x00000000,0x00000000,0x00000000,0x00000000,0x00000040,
0x00000000,0x00004000,0x00000000,0x00004040,0x00000000,0x00400000,
0x00000000,0x00400040,0x00000000,0x00404000,0x00000000,0x00404040,
0x00000000,0x40000000,0x00000000,0x40000040,0x00000000,0x40004000,
0x00000000,0x40004040,0x00000000,0x40400000,0x00000000,0x40400040,
0x00000000,0x40404000,0x00000000,0x40404040,0x00000000,0x00000000,
0x00000010,0x00000000,0x00001000,0x00000000,0x00001010,0x00000000,
0x00100000,0x00000000,0x00100010,0x00000000,0x00101000,0x00000000,
0x00101010,0x00000000,0x10000000,0x00000000,0x10000010,0x00000000,
0x10001000,0x00000000,0x10001010,0x00000000,0x10100000,0x00000000,
0x10100010,0x00000000,0x10101000,0x00000000,0x10101010,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000010,0x00000000,0x00001000,
0x00000000,0x00001010,0x00000000,0x00100000,0x00000000,0x00100010,
0x00000000,0x00101000,0x00000000,0x00101010,0x00000000,0x10000000,
0x00000000,0x10000010,0x00000000,0x10001000,0x00000000,0x10001010,
0x00000000,0x10100000,0x00000000,0x10100010,0x00000000,0x10101000,
0x00000000,0x10101010,0x00000000,0x00000000,0x00000004,0x00000000,
0x00000400,0x00000000,0x00000404,0x00000000,0x00040000,0x00000000,
0x00040004,0x00000000,0x00040400,0x00000000,0x00040404,0x00000000,
0x04000000,0x00000000,0x04000004,0x00000000,0x04000400,0x00000000,
0x04000404,0x00000000,0x04040000,0x00000000,0x04040004,0x00000000,
0x04040400,0x00000000,0x04040404,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000004,0x00000000,0x00000400,0x00000000,0x00000404,
0x00000000,0x00040000,0x00000000,0x00040004,0x00000000,0x00040400,
0x00000000,0x00040404,0x00000000,0x04000000,0x00000000,0x04000004,
0x00000000,0x04000400,0x00000000,0x04000404,0x00000000,0x04040000,
0x00000000,0x04040004,0x00000000,0x04040400,0x00000000,0x04040404,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000100,0x00000000,
0x00000101,0x00000000,0x00010000,0x00000000,0x00010001,0x00000000,
0x00010100,0x00000000,0x00010101,0x00000000,0x01000000,0x00000000,
0x01000001,0x00000000,0x01000100,0x00000000,0x01000101,0x00000000,
0x01010000,0x00000000,0x01010001,0x00000000,0x01010100,0x00000000,
0x01010101,0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x00000100,0x00000000,0x00000101,0x00000000,0x00010000,
0x00000000,0x00010001,0x00000000,0x00010100,0x00000000,0x00010101,
0x00000000,0x01000000,0x00000000,0x01000001,0x00000000,0x01000100,
0x00000000,0x01000101,0x00000000,0x01010000,0x00000000,0x01010001,
0x00000000,0x01010100,0x00000000,0x01010101,0x00000000,0x00000000,
0x00000080,0x00000000,0x00008000,0x00000000,0x00008080,0x00000000,
0x00800000,0x00000000,0x00800080,0x00000000,0x00808000,0x00000000,
0x00808080,0x00000000,0x80000000,0x00000000,0x80000080,0x00000000,
0x80008000,0x00000000,0x80008080,0x00000000,0x80800000,0x00000000,
0x80800080,0x00000000,0x80808000,0x00000000,0x80808080,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000080,0x00000000,0x00008000,
0x00000000,0x00008080,0x00000000,0x00800000,0x00000000,0x00800080,
0x00000000,0x00808000,0x00000000,0x00808080,0x00000000,0x80000000,
0x00000000,0x80000080,0x00000000,0x80008000,0x00000000,0x80008080,
0x00000000,0x80800000,0x00000000,0x80800080,0x00000000,0x80808000,
0x00000000,0x80808080,0x00000000,0x00000000,0x00000020,0x00000000,
0x00002000,0x00000000,0x00002020,0x00000000,0x00200000,0x00000000,
0x00200020,0x00000000,0x00202000,0x00000000,0x00202020,0x00000000,
0x20000000,0x00000000,0x20000020,0x00000000,0x20002000,0x00000000,
0x20002020,0x00000000,0x20200000,0x00000000,0x20200020,0x00000000,
0x20202000,0x00000000,0x20202020,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000020,0x00000000,0x00002000,0x00000000,0x00002020,
0x00000000,0x00200000,0x00000000,0x00200020,0x00000000,0x00202000,
0x00000000,0x00202020,0x00000000,0x20000000,0x00000000,0x20000020,
0x00000000,0x20002000,0x00000000,0x20002020,0x00000000,0x20200000,
0x00000000,0x20200020,0x00000000,0x20202000,0x00000000,0x20202020,
0x00000000,0x00000000,0x00000008,0x00000000,0x00000800,0x00000000,
0x00000808,0x00000000,0x00080000,0x00000000,0x00080008,0x00000000,
0x00080800,0x00000000,0x00080808,0x00000000,0x08000000,0x00000000,
0x08000008,0x00000000,0x08000800,0x00000000,0x08000808,0x00000000,
0x08080000,0x00000000,0x08080008,0x00000000,0x08080800,0x00000000,
0x08080808,0x00000000,0x00000000,0x00000000,0x00000000,0x00000008,
0x00000000,0x00000800,0x00000000,0x00000808,0x00000000,0x00080000,
0x00000000,0x00080008,0x00000000,0x00080800,0x00000000,0x00080808,
0x00000000,0x08000000,0x00000000,0x08000008,0x00000000,0x08000800,
0x00000000,0x08000808,0x00000000,0x08080000,0x00000000,0x08080008,
0x00000000,0x08080800,0x00000000,0x08080808,0x00000000,0x00000000,
0x00000002,0x00000000,0x00000200,0x00000000,0x00000202,0x00000000,
0x00020000,0x00000000,0x00020002,0x00000000,0x00020200,0x00000000,
0x00020202,0x00000000,0x02000000,0x00000000,0x02000002,0x00000000,
0x02000200,0x00000000,0x02000202,0x00000000,0x02020000,0x00000000,
0x02020002,0x00000000,0x02020200,0x00000000,0x02020202,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000002,0x00000000,0x00000200,
0x00000000,0x00000202,0x00000000,0x00020000,0x00000000,0x00020002,
0x00000000,0x00020200,0x00000000,0x00020202,0x00000000,0x02000000,
0x00000000,0x02000002,0x00000000,0x02000200,0x00000000,0x02000202,
0x00000000,0x02020000,0x00000000,0x02020002,0x00000000,0x02020200,
0x00000000,0x02020202};
unsigned char Pmask[]={
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
unsigned char PC1tbl[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char PC2tbl[]={
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,
0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,
0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x20,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,
0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x00,0x00,0x00};
unsigned long sp_table[]={
0x00828000,0x00000000,0x00800000,0x02828000,0x02808000,0x02820000,
0x02000000,0x00800000,0x00020000,0x00828000,0x02828000,0x00020000,
0x02028000,0x02808000,0x00008000,0x02000000,0x02020000,0x00028000,
0x00028000,0x00820000,0x00820000,0x00808000,0x00808000,0x02028000,
0x02800000,0x02008000,0x02008000,0x02800000,0x00000000,0x02020000,
0x02820000,0x00008000,0x00800000,0x02828000,0x02000000,0x00808000,
0x00828000,0x00008000,0x00008000,0x00020000,0x02808000,0x00800000,
0x00820000,0x02008000,0x00020000,0x02000000,0x02028000,0x02820000,
0x02828000,0x02800000,0x00808000,0x02028000,0x02008000,0x02020000,
0x02820000,0x00828000,0x02020000,0x00028000,0x00028000,0x00000000,
0x02800000,0x00820000,0x00000000,0x02808000,0x10400840,0x00400040,
0x00400000,0x10400800,0x00000800,0x10000000,0x10000840,0x10400040,
0x10000040,0x10400840,0x00400840,0x00000040,0x00400040,0x00000800,
0x10000000,0x10000840,0x00400800,0x10000800,0x10400040,0x00000000,
0x00000040,0x00400000,0x10400800,0x00000840,0x10000800,0x10000040,
0x00000000,0x00400800,0x10400000,0x00400840,0x00000840,0x10400000,
0x00000000,0x10400800,0x10000840,0x00000800,0x10400040,0x00000840,
0x00400840,0x00400000,0x00000840,0x00400040,0x10000000,0x10400840,
0x10400800,0x10000000,0x00400000,0x00000040,0x10400000,0x00400840,
0x00000800,0x10000040,0x10000800,0x10400040,0x10000040,0x10000800,
0x00400800,0x00000000,0x00400040,0x10400000,0x00000040,0x10000840,
0x10400840,0x00400800,0x04010000,0x00010104,0x00000000,0x04000104,
0x00010004,0x00000000,0x04010100,0x00010004,0x04000100,0x04000004,
0x04000004,0x00000100,0x04010104,0x04000100,0x00000104,0x04010000,
0x00000004,0x04000000,0x00010104,0x00010000,0x00010100,0x00000104,
0x04000104,0x04010100,0x04010004,0x00010100,0x00000100,0x04010004,
0x04000000,0x04010104,0x00010000,0x00000004,0x00010104,0x00000004,
0x04000100,0x04010000,0x00000100,0x00010104,0x00010004,0x00000000,
0x00010000,0x04000100,0x04010104,0x00010004,0x04000004,0x00010000,
0x00000000,0x04000104,0x04010004,0x00000100,0x00000004,0x04010104,
0x04000000,0x04010100,0x00010100,0x04000004,0x00000104,0x04010004,
0x04010000,0x00000104,0x04010100,0x04000000,0x04000104,0x00010100,
0x00104080,0x40100080,0x40100080,0x40000000,0x40104000,0x40004080,
0x00004080,0x00100080,0x00000000,0x00104000,0x00104000,0x40104080,
0x40000080,0x00000000,0x40004000,0x00004080,0x00000080,0x00100000,
0x00004000,0x00104080,0x40000000,0x00004000,0x00100080,0x40100000,
0x40004080,0x00000080,0x40100000,0x40004000,0x00100000,0x40104000,
0x40104080,0x40000080,0x40004000,0x00004080,0x00104000,0x40104080,
0x40000080,0x00000000,0x00000000,0x00104000,0x40100000,0x40004000,
0x40004080,0x00000080,0x00104080,0x40100080,0x40100080,0x40000000,
0x40104080,0x40000080,0x00000080,0x00100000,0x00004080,0x00100080,
0x40104000,0x40004080,0x00100080,0x40100000,0x00004000,0x00104080,
0x40000000,0x00004000,0x00100000,0x40104000,0x80000000,0x80000401,
0x00000401,0x80000021,0x00000400,0x80000000,0x00000020,0x00000401,
0x80000420,0x00000400,0x80000001,0x80000420,0x80000021,0x00000421,
0x80000400,0x00000020,0x00000001,0x00000420,0x00000420,0x00000000,
0x80000020,0x80000421,0x80000421,0x80000001,0x00000421,0x80000020,
0x00000000,0x00000021,0x80000401,0x00000001,0x00000021,0x80000400,
0x00000400,0x80000021,0x80000000,0x00000001,0x00000020,0x00000401,
0x80000021,0x80000420,0x80000001,0x00000020,0x00000421,0x80000401,
0x80000420,0x80000000,0x00000001,0x00000421,0x80000421,0x80000400,
0x00000021,0x80000421,0x00000401,0x00000000,0x00000420,0x00000021,
0x80000400,0x80000001,0x80000020,0x00000400,0x00000000,0x00000420,
0x80000401,0x80000020,0x08000010,0x00002010,0x00200000,0x08202010,
0x00002010,0x08000000,0x08202010,0x00002000,0x00200010,0x08202000,
0x00002000,0x08000010,0x08002000,0x00200010,0x00000010,0x08200000,
0x00000000,0x08002000,0x08200010,0x00200000,0x00202000,0x08200010,
0x08000000,0x08002010,0x08002010,0x00000000,0x08202000,0x00202010,
0x08200000,0x00202000,0x00202010,0x00000010,0x00200010,0x08000000,
0x08002010,0x00202000,0x08202010,0x00002000,0x08200000,0x08000010,
0x00002000,0x00200010,0x00000010,0x08200000,0x08000010,0x08202010,
0x00202000,0x00002010,0x08202000,0x00202010,0x00000000,0x08002010,
0x08000000,0x00200000,0x00002010,0x08202000,0x00200000,0x08002000,
0x08200010,0x00000000,0x00202010,0x00000010,0x08002000,0x08200010,
0x00001000,0x01001002,0x01040002,0x00000000,0x00040000,0x01040002,
0x01041000,0x00041002,0x01041002,0x00001000,0x00000000,0x01000002,
0x01000000,0x00000002,0x01001002,0x01040000,0x00040002,0x01041000,
0x01001000,0x00040002,0x01000002,0x00001002,0x00041002,0x01001000,
0x00001002,0x00040000,0x01040000,0x01041002,0x00041000,0x01000000,
0x00000002,0x00041000,0x00000002,0x00041000,0x00001000,0x01040002,
0x01040002,0x01001002,0x01001002,0x01000000,0x01001000,0x00000002,
0x00040002,0x00001000,0x00041002,0x01040000,0x01041000,0x00041002,
0x01040000,0x01000002,0x01041002,0x00001002,0x00041000,0x00000000,
0x01000000,0x01041002,0x00000000,0x01041000,0x00001002,0x00040000,
0x01000002,0x00040002,0x00040000,0x01001000,0x20080008,0x00080000,
0x00000200,0x20080208,0x00000008,0x20080008,0x20000000,0x00000008,
0x20000200,0x00000208,0x20080208,0x00080200,0x00080208,0x20080200,
0x00080000,0x20000000,0x00000208,0x20000008,0x00080008,0x20080000,
0x00080200,0x20000200,0x20000208,0x00080208,0x20080000,0x00000000,
0x00000000,0x20000208,0x20000008,0x00080008,0x20080200,0x00000200,
0x20080200,0x00000200,0x00080208,0x00080000,0x20000000,0x20000208,
0x00080000,0x20080200,0x00080008,0x20000000,0x20000008,0x00000208,
0x20000208,0x00000008,0x00000200,0x20080008,0x00000000,0x20080208,
0x20000200,0x20000008,0x00000208,0x00080008,0x20080008,0x00000000,
0x20080208,0x00080200,0x00080200,0x20080000,0x20080000,0x20000200,
0x00000008,0x00080208};
void des_encrypt(unsigned int *bl,unsigned char* kp,unsigned int mode)
{
    static unsigned char * keyptr;
    static unsigned int loopcount;
    static unsigned int block[2];
    keyptr=kp;
    block[0]=bl[0];
    block[1]=bl[1];
    _asm{
    cmp [mode],0
    jz decrypt_block
    push esi
    push edi
    push ebp
    mov esi, offset p1
    mov edx,dword ptr[block]
    mov eax,dword ptr[block+4]
    call l_permute
    mov eax,edi
    mov esi,[keyptr]
    add esi,7
    mov [loopcount],16
dxlp1:
    and ebx,0ffffh
    mov edx,eax
    mov ecx,eax
    bswap edx
    sub eax,eax
    mov edi,offset sp_table+7*4*64
    rol edx,3
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    xor eax,ebp
    add esi,16
    mov ebp,ecx
    dec [loopcount]
    jnz dxlp1
    mov esi, offset p2
    mov edx,eax
    mov eax,ebp
    call l_permute
    mov ebx,ebp
    pop ebp
    mov [block],ebx
    mov dword ptr[block+4],edi
    pop edi
    pop esi
    jmp ddone
decrypt_block:
    push esi
    push edi
    push ebp
    mov esi, offset p1
    mov edx,dword ptr[block]
    mov eax,dword ptr[block+4]
    call l_permute
    mov [loopcount],16
    mov esi,[de_keyptr]
    mov esi,[keyptr]
    add esi,15*8+7
    mov eax, edi
dxlp2:    and ebx,0ffffh
    mov edx,eax
    mov ecx,edx
    bswap edx
    sub eax,eax
    mov edi,offset sp_table + 7*4*64
    rol edx,3
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec si
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub edi,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    ror edx,4
    sub di,4*64
    mov bx,dx
    xor bl,[esi]
    and bx,11111100b
    dec esi
    or eax, [ebx+edi]
    xor eax,ebp
    mov ebp,ecx
    dec [loopcount]
    jnz dxlp2
    mov esi,offset p2
    mov edx,eax
    mov eax,ebp
    call l_permute
    mov ebx,ebp
    pop ebp
    mov [block],ebx
    mov [block+4],edi
    pop edi
    pop esi
    jmp ddone
l_permute:
    movzx ebx,dx
    shl bx,3
    and bx,1111000b
    shr edx,1
    mov ebp,[esi+ebx]
    mov edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    shr edx,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    shr edx,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    shr edx,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    shr edx,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    shr edx,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    shr edx,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,dx
    and bx,1111000b
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx,ax
    shl bx,3
    and bx,1111000b
    shr eax,1
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    shr eax,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    shr eax,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    shr eax,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    shr eax,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    shr eax,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    shr eax,4
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    add esi,8*16
    mov bx, ax
    and bx,1111000b
    or ebp,[esi+ebx]
    or edi,[esi+4+ebx]
    ret
ddone:
}
    bl[0]=block[0];
    bl[1]=block[1];
}
void permute(long *op,long *ip, char *tbl,int n)
{
    _asm
    {
    mov ebx,[op]
    mov esi,[tbl]
    mov edi,offset Pmask
    mov dword ptr[ebx],0
    mov dword ptr[ebx+4],0
    mov ebx,[ip]
    mov eax,[ebx]
    mov edx,[ebx+4]
    mov ecx,[n]
pm1:    mov ebx,[esi]
    test eax,ebx
    jnz pmis_hit
    mov ebx,[esi+4]
    test edx,ebx
    jz pmno_hit
pmis_hit:
    push esi
    mov esi,[op]
    mov ebx,[edi]
    or [esi],ebx
    mov ebx,[edi+4]
    or [esi+4],ebx
    pop esi
pmno_hit:
    add esi,8
    add edi,8
    loop pm1
    }
}
void rotate(long *input,int count)
 {
    _asm
    {
    mov ecx,[count]
    mov ebx,[input]
    mov eax,[ebx]
    bswap eax
    xor ebx,ebx
    shld ebx, eax,cl
    shl eax,cl
    shl ebx,4
    add eax,ebx
    mov ebx,[input]
    bswap eax
    mov [ebx],eax
    }
}
void set_table(char*input,int num,long*tbl)
{
    _asm
    {
    mov edi, [tbl]
    mov eax,[num]
    mov bl,8
    mul bl
    add edi,eax
    mov ebx,[input]
    mov dx,word ptr[ebx+4]
    bswap edx
    mov ebx,[ebx]
    bswap ebx
    mov cx,8
stble1:
    shld eax,ebx,6
    shld ebx,edx,6
    shl edx,6
    shl ax,2
    and al,11111100b
    mov [edi],al
    inc edi
    loop stble1
    }
}
void des_key_sched(char * password, unsigned char *keytble)
{

    static char *input;
    static unsigned char *tbl;
    static unsigned long block1[2];
    static unsigned long temp [2];
    static loopcount;
    static unsigned short r_sched[]=
    {
        1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1
    };
    input=password;
    tbl=keytble;
    _asm
    {
    push ebp
    push edi
    push 64
    push offset PC1tbl
    mov ebx,[input]
    push ebx
    push offset temp
    call permute
    add sp,8*2
    mov ecx,16
    mov [loopcount],ecx
    xor edi,edi
sch1:
    mov ebx,edi
    shl ebx,1
    add ebx,offset r_sched
    movzx eax,[word ptr ebx]
    push eax
    push eax
    push offset temp
    call rotate
    add esp,4*2
    push offset temp+4
    call rotate
    add esp,4*2
    push 48
    push offset PC2tbl
    push offset temp
    push offset block1
    call permute
    add esp,8*2
    mov eax,[tbl]
    push eax
    push edi
    push offset block1
    call set_table
    add esp,6*2
    inc edi
    dec [loopcount]
    jnz sch1
    mov ebx,[input]
    mov cx,4
    xor ax,ax
sch2:    mov [ebx],ax
    inc ebx
    inc ebx
    loop sch2
    pop edi
    pop ebp
    jmp scdone
scdone:
    }
}
void desencipher(unsigned long *b, int slot)
{
    des_encrypt(b,sdisk_des_keys[slot].e,DES_ENCRYPT);
}
void threedesencipher(unsigned long *b, int slot)
{
    des_encrypt(b, sdisk_des_keys[slot].e,DES_ENCRYPT);
    des_encrypt(b, sdisk_des_keys[slot].d,DES_DECRYPT);
    des_encrypt(b, sdisk_des_keys[slot].e2,DES_ENCRYPT);
}
void desdecipher(unsigned long *b, int slot)
{
    des_encrypt(b, sdisk_des_keys[slot].e,DES_DECRYPT);
}
void threedesdecipher(unsigned long *b, int slot)
{
    des_encrypt(b, sdisk_des_keys[slot].e2,DES_DECRYPT);
    des_encrypt(b, sdisk_des_keys[slot].d,DES_ENCRYPT);
    des_encrypt(b, sdisk_des_keys[slot].e,DES_DECRYPT);
}
void desinitialise(char *key,int slot)
{
    des_key_sched(key,sdisk_des_keys[slot].e);
}
void threedesinitialise(char *key,int slot)
{
    char *key2=key+8;
    char *key3=key2+8;
    des_key_sched(key,sdisk_des_keys[slot].e);
    des_key_sched(key2,sdisk_des_keys[slot].d);
    des_key_sched(key3,sdisk_des_keys[slot].e2);
}
void main (void)
{
unsigned char key[]={0x1f,0x08,0x26,0x0d,0x1a,0xc2,0x46,0x5e};
unsigned char key3[]=
    {
    0x1f,0x08,0x26,0x0d,0x1a,0xc2,0x46,0x5e,
    0x44,0x28,0x1d,0x6b,0x61,0x11,0x52,0x47,
    0x12,0x41,0x34,0x26,0x1d,0x3e,0xf4,0x45
    };
unsigned char cipher[]={0xef,0x1b,0xf0,0x3e,0x5d,0xfa,0x57,0x5a};
    desinitialise(key,0);
    desdecipher((unsigned long *) cipher,0);
    desencipher((unsigned long *) cipher,0);
    threedesinitialise(key3,0);
    threedesdecipher((unsigned long *) cipher,0);
    threedesencipher((unsigned long *) cipher,0);
}

Категория: Реализация шифров | Добавил: flame (26.05.2009)
Просмотров: 254 | Теги: DES C++ Source Code | Рейтинг: 0.0/0 |
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]

Форма входа

Поиск

Статистика


Онлайн всего: 1
Гостей: 1
Пользователей: 0