using system;
using system.security.cryptography;
using system.web.security;
using system.io;
using system.text;
using system.configuration;
namespace ***x.common
catch}}
/// /// 加密方法
///
/// 待加密字元
///
public static string encrypt(string encryptstring)
//get the data back from the memory stream, and into a string
stringbuilder ret = new stringbuilder();
array.foreach(ms.toarray(),
delegate(byte b)
);ret.tostring();
return ret.tostring();}}
}/// /// 加密方法
///
/// 待加密字元
/// 金鑰
///
public static string encrypt(string encryptstring,string key)
//get the data back from the memory stream, and into a string
stringbuilder ret = new stringbuilder();
array.foreach(ms.toarray(),
delegate(byte b)
);ret.tostring();
return ret.tostring();}}
}/// /// 解密方法
///
/// 待解密字元
/// 金鑰
///
public static string decrypt(string decryptstring,string key)
//建立加密物件的金鑰和偏移量,此值重要,不能修改
des.key = encoding.ascii.getbytes(formsauthentication.hashpasswordforstoringinconfigfile(key, "md5").substring(0, 8));
des.iv = encoding.ascii.getbytes(formsauthentication.hashpasswordforstoringinconfigfile(key, "md5").substring(0, 8));
using (memorystream ms = new memorystream())
//get the decrypted data back from the memory stream
return encoding.default.getstring(ms.toarray());}}
}/// /// 解密方法
///
/// 待解密字元
///
public static string decrypt(string decryptstring)
//建立加密物件的金鑰和偏移量,此值重要,不能修改
des.key = encoding.ascii.getbytes(formsauthentication.hashpasswordforstoringinconfigfile(deskey, "md5").substring(0, 8));
des.iv = encoding.ascii.getbytes(formsauthentication.hashpasswordforstoringinconfigfile(deskey, "md5").substring(0, 8));
using(memorystream ms = new memorystream())
//get the decrypted data back from the memory stream
return encoding.default.getstring(ms.toarray());}}
} }
}
字串加解密
題目 1 對輸入的字串進行加解密,並輸出。2加密方法為 當內容是英文本母時則用該英文本母的後乙個字母替換,同時字母變換大小寫,如字母a時則替換為b 字母z時則替換為a 當內容是數字時則把該數字加1,如0替換1,1替換2,9替換0 其他字元不做變化。3 解密方法為加密的逆過程。輸入 輸入一串要加密的密...
字串加解密
題目描述 1 對輸入的字串進行加解密,並輸出。2 加密方法為 當內容是英文本母時則用該英文本母的後乙個字母替換,同時字母變換大小寫,如字母a時則替換為b 字母z時則替換為a 當內容是數字時則把該數字加1,如0替換1,1替換2,9替換0 其他字元不做變化。3 解密方法為加密的逆過程。介面描述 實現介面...
字串加解密
描述 1 對輸入的字串進行加解密,並輸出。2 加密方法為 當內容是英文本母時則用該英文本母的後乙個字母替換,同時字母變換大小寫,如字母a時則替換為b 字母z時則替換為a 當內容是數字時則把該數字加1,如0替換1,1替換2,9替換0 其他字元不做變化。3 解密方法為加密的逆過程。輸入輸入一串要加密的密...