有关于DES算法的C语言源代码嘛?急需,能直接运行的

来源:百度知道 编辑:UC知道 时间:2024/06/21 09:17:52
C或C++都可以

//////////////////////////////////////////////////////////////////////////
/*
Provided by 王俊川, Northeastern University (www.neu.edu.cn)
Email: blackdrn@sohu.com
This product is free for use.
*/
//////////////////////////////////////////////////////////////////////////

#include "memory.h"
enum {ENCRYPT,DECRYPT};

//////////////////////////////////////////////////////////////////////////

// initial permutation IP
const static char IP_Table[64] = {
58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
};
// final permutation IP^-1
const static char IPR_Table[64] = {
40, 8, 48, 16,