C 檔案解密

2021-09-20 03:16:55 字數 1871 閱讀 4100

對已經加密的私密檔案進行解密

//選擇解密檔案

private

void

button1_click(

object

sender,

eventargs

e)else}}

//解密

private

void

button3_click(

object

sender,

eventargs

e)}}

#region

定義全域性變數及類物件

private

string

strfile = "";

private

string

strnewfile = "";

private

string

strpwd = "";

private

progressbar

pbar =

null;

private

thread

ethread =

null;

private

thread

dthread =

null;

#endregion //

檔案解密

private

void

mydthread();} if

(strpwd.length == 7) ; }

if(strpwd.length >= 8) ;}

fstream =

newfilestream

(strfile,

filemode

.open,

fileaccess

.read);

strnewfile = strfile.substring(0, strfile.length - 3);

newfstream =

newfilestream

(strnewfile,

filemode

.openorcreate,

fileaccess

.write);

newfstream.setlength((

long

)0);

byte

buffer =

newbyte

[0x400];

intminnum = 0;

long

length = fstream.length; pbar.maximum = maxnum;

intmaxnum = (

int)(length / ((

long

)0x400));

desmydes =

newdescryptoserviceprovider

();

cstream =

newcryptostream

(newfstream, mydes.createdecryptor(btrkey, btrkey),

cryptostreammode

.write);

while

(minnum < length) }

catch

{}}

messagebox

.show(

"檔案解密成功!", "

資訊提示"

, messageboxbuttons

.ok, }

catch

} finally

} //

執行解密執行緒

public

void

startdncrypt()

C 檔案簡單加解密

include include includevoid encfile char in filename,char pwd,char out filename 對檔案進行加密的具體函式 void decryptfile char in filename,char pwd,char out filen...

C語言(檔案加解密)

在c語言,檔案主要分為文字檔案和二進位制檔案,因此主要是對這兩種檔案進行加解密。原檔案 加密對每乙個字元進行 異或運算 規則 1 1 0,0 0 0,1 0 1,0 1 1 同為0,不同為1 void crpypt char file path,char crpypt path 關閉 fclose ...

檔案加解密 解密版

include stdafx.h include des.h define crt secure no warnings include include include pragma warning disable 4996 int filesymenc const char pfile1,cons...