Fetch the repository succeeded.
目标:实现在线预览,加密、编码、转换等工具,功能点如下:
string password = "12345678";
string sourceString = "{'idcard':'330781198509077211','date':'2021-11-11 19:04'}";
Console.WriteLine("源字符串:" + sourceString);
var c = DESUtil.Encrypt(sourceString, password);
//加密:3tL0BBKZyUpIfO+XJKL1VoeQhEWc0enGG8R//RPBJQCiykspXEBmvabp8yrWTBv+QUL62K7dUL+vbpYV/PwZvw==
Console.WriteLine("加密:" + c);
c = HttpUtility.UrlEncode(c);
Console.WriteLine("url编码:" + c);
Console.WriteLine("================");
c = HttpUtility.UrlDecode(c);
Console.WriteLine("url解码:" + c);
try
{
c = DESUtil.Decrypt(c, password);
Console.WriteLine("url解密:" + c);
var user = JsonConvert.DeserializeObject<User>(c);
Console.WriteLine("反序列化\n日期:" + user.date);
Console.WriteLine("身份证号:" + user.idcard);
}
catch (Exception e)
{
Console.WriteLine("无法解密:" + e.StackTrace + e.Message);
}
Console.WriteLine("------over--------");
Console.ReadLine();
String password="12345678";
String den = DESUtil.encrypt("{'idcard':'330781198509077211','date':'2021-11-11 19:04'}",password);
System.out.println("加密:"+den);
String CHARSET="utf-8";
String encodeStr= URLEncoder.encode(den,CHARSET);
System.out.println("url编码:"+den);
String decodeUrl=URLDecoder.decode(encodeStr,CHARSET);
System.out.println("url解码:"+decodeUrl);
String ert = DESUtil.decrypt(decodeUrl,password);
System.out.println("url解密:"+ert);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。