using system.security.cryptography;
using system.io;
//加密函式
static stirng encrypt(string str)
descryptoserviceprovider descsp=new descryptoserviceprovider();
byte key=encoding.unicode.getbytes(encryptkey);
byte data=encoding.unicode.getbytes(str);
memorystream mstream=new memorystream();
cryptostream cstream= new cryptostream(mstream,descsp.createencryptor(key,key),cryptostreammode.write);
cstream.write(data,0,data.length);
cstream.flushfinalblock();
return convert.tobase64string(mstream.toarray());
//解密函式
static stirng decrypt(string str)
descryptoserviceprovider descsp=new descryptoserviceprovider();
byte key=encoding.unicode.getbytes(encryptkey);
byte data=convert.frombase64string(str);
memorystream mstream=new memorystream();
cryptostream cstream= new cryptostream(mstream,descsp.createencryptor(key,key),cryptostreammode.write);
cstream.write(data,0,data.length);
cstream.flushfinalblock();
return encoding.unicode.getstring(mstream.toarray());
C DES加密 解密字串
c des加密 解密字串 新增引用 using system using system.text using system.security.cryptography using system.io 預設金鑰向量 private static byte keys des加密字串 待加密的字串 加密金...
Delphi字串加密解密
www.u8686.com 資訊發布平台 delphi字串加密解密函式 作用 可用作密碼的和一些重要引數的儲存,資料經加密後儲存即使被人看到了也無防。首先定義乙個常量陣列 const xorkey array 0.7 of byte b2,09,aa,55,93,6d,84,47 字串加密用 然後在...
DES加密解密字串
金鑰隨機生成 class des 建立key public string generatekey descryptoserviceprovider descrypto descryptoserviceprovider descryptoserviceprovider.create return as...