DES加密 解密

2022-01-23 11:27:26 字數 1738 閱讀 1554

1

///2

///des加密(資料加密標準,速度較快,適用於加密大量資料的場合)

3///

4///

待加密的密文

5///

加密的金鑰

6///

returns

7public

static

string desencrypt(string encryptstring, string

encryptkey)813

14if (string.isnullorempty(encryptkey) || encryptkey.length != 8)15

18byte m_btiv = ;

19string m_strencrypt = ""

;20 descryptoserviceprovider m_desprovider = new

descryptoserviceprovider();

2122

try23

33catch (ioexception ex)

34catch (cryptographicexception ex)

35catch (argumentexception ex)

36catch (exception ex)

37finally

3839

return

m_strencrypt;

40 }

1

///2

///des 解密(資料加密標準,速度較快,適用於加密大量資料的場合)

3///

4///

待解密的密文

5///

解密的金鑰

6///

returns

7public

static

string desdecrypt(string decryptstring, string

decryptkey)813

14if (string.isnullorempty(decryptkey) || decryptkey.length != 8)15

1819

byte m_btiv = ;

20string m_strdecrypt = ""

;21 descryptoserviceprovider m_desprovider = new

descryptoserviceprovider();

2223

try24

3435

catch

(ioexception ex)

36catch

(cryptographicexception ex)

37catch

(argumentexception ex)

38catch

(exception ex)

39finally

4041

return

m_strdecrypt;

42 }

【原文出處】

DES加密解密

using system using system.drawing using system.collections using system.componentmodel using system.windows.forms using system.data using system.io us...

DES加密解密

加密類 date 2012 04 23 pm.public class encrypt private encrypt 建立加密類物件.public static encrypt createcryptoserviceprovider des加密.待加密字串.加密金鑰.8位 public strin...

DES加密解密

using system.data using system.configuration using system.web using system.web.security using system.web.ui using system.web.ui.webcontrols using syst...