资源简介
c语言实现的对任意长度的字符串加解密
代码片段和文件信息
#include “stdio.h“
#include “time.h“
#include “stdlib.h“
#include “string.h“
#define PLAIN_FILE_OPEN_ERROR -1
#define KEY_FILE_OPEN_ERROR -2
#define CIPHER_FILE_OPEN_ERROR -3
#define OK 1;
typedef char ElemType;
/* 初始置换表IP */
int IP_Table[64] = { 57494133251791
595143352719113
615345372921135
635547393123157
56484032241680
585042342618102
605244362820124
625446383022146};
/* 逆初始置换表IP^-1 */
int IP_1_Table[64] = {397471555236331
386461454226230
375451353216129
364441252206028
353431151195927
342421050185826
33141949175725
32040848165624};
/* 扩充置换表E */
int E_Table[48] = {31 0 1 2 3 4
3 4 5 6 7 8
7 89101112
111213141516
151617181920
192021222324
232425262728
2728293031 0};
/* 置换函数P */
int P_Table[32] = {156192028112716
0142225417309
172313312628
18122952110324};
/* S盒 */
int S[8][4][16] =/* S1 */
{{{1441312151183106125907}
{0157414213110612119538}
{4114813621115129731050}
{1512824917511314100613}}
/* S2 */
{{1518146113497213120510}
{3134715281412011069115}
{0147111041315812693215}
{1381013154211671205149}}
/* S3 */
{{1009146315511312711428}
{1370934610285141211151}
{1364981530111212510147}
{1101306987415143115212}}
/* S4 */
{{7131430691012851112415}
{1381156150347212110149}
{1069012117131513145284}
{3150610113894511127214}}
/* S5 */
{{2124171011685315130149}
{1411212471315015103986}
{4211110137815912563014}
{1181271142136150910453}}
/* S6 */
{{1211015926801334147511}
{1015427129561131401138}
{9141552812370410113116}
{4321295151011141760813}}
/* S7 */
{{4112141508133129751061}
{1301174911014351221586}
{1411131237141015680592}
{6111381410795015142312}}
/* S8 */
{{1328461511110931450127}
{1151381037412561101492}
{7114191214206101315358}
{2114741081315129035611}}};
/* 置换选择1 */
int PC_1[56] = {5648403224168
0574941332517
915850423426
1810259514335
62544638302214
6615345372921
1356052443628
201242719113};
/* 置换选择2 */
int PC_2[48] = {1316102304227
1452092218113
2571562619121
4051303
评论
共有 条评论