91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-20
  • 語言: C/C++
  • 標簽: RC4??C語言??

資源簡介

使用RC4加密算法對文件進行加密或者解密,C語言實現

資源截圖

代碼片段和文件信息

#include?
#include?
#include?

#define?FNAME?30

void?Initial(char?*);????//初始化的函數
unsigned?int?S[256];????//?S數組

int?main()
{
char?FNameR[FNAME]FNameW[FNAME];????//用于存儲文件路徑的數組
FILE?*rFile?*wFile;????//文件指針
char??rChar=0wChar=0;????//一個要讀取的字符,一個要寫入的字符????
char?opttemk;
long?int?last=0;????//要讀取的文件的長度
char?key[257];????//密鑰
//用戶輸入部分
printf(“…………………………?RC4?Cipher?…………………………“);
printf(“\n\nWhich?do?you?want?to?do?encryption?or?decryption???“);????//選擇加密或解密
printf(“\n(Enter?e?or?d):?“?);
scanf(“%c“&opt);
fflush(stdin);????//清空輸入流
printf(“Please?enter?a?file?path?to?read:?“);????//輸入讀文件的路徑
gets(FNameR);
rFile=fopen(FNameR“rb“);
if?(rFile==NULL)????//如果打開文件失敗,提示用戶
{
printf(“\nFailed?to?open?the?file?to?read.“);
exit(1);
}
printf(“Please?enter?a?file?path?to?write:?“);????//輸入寫文件的路徑
gets(FNameW);
wFile=fopen(FNameW“wb“);
if?(wFile==NULL)????//如果打開文件失敗,提示用戶
{
printf(“\nFailed?to?open?the?file?to?write.“);
exit(1);
}
printf(“Please?enter?the?key?(less?than?256):?“);????//輸入密鑰
gets(key);
printf(“你輸入的密鑰是:“);
puts(key);
????//程序的輸出部分
printf(“\n**********************?Output?**********************“);
????fseek(rFile0LSEEK_SET);?????//移到讀取文件的開始
fseek(rFile0LSEEK_END);?????//

評論

共有 條評論