C#.NET史上最全字符串加密/解密/数字签名工具(CryptoHelper.cs)
C#.NET史上最全字符串加密/解密/数字签名工具(CryptoHelper.cs)
CryptoHelper 测试
C# Code:
string text = "www.csframework.com/www.cscode.net C/S框架网测试";
txtResponse.Text = CryptoHelper.ToMD5(text);
MessageBox.Show("ToMD5:" txtResponse.Text);
txtResponse.Text = CryptoHelper.ToSHA256Hash(text);
MessageBox.Show("ToSHA256Hash:" txtResponse.Text);
txtResponse.Text = CryptoHelper.ToSHA512Hash(text);
MessageBox.Show("ToSHA512Hash:" txtResponse.Text);
string privateKey; string publicKey;
CryptoHelper.DSAGetKey(out privateKey, out publicKey);
txtResponse.Text = CryptoHelper.DSASign(text, privateKey);
MessageBox.Show("DSASign:" txtResponse.Text);
bool ss = CryptoHelper.DSAVerify(text, txtResponse.Text, publicKey);
txtResponse.Text = ss ? "验证成功" : "验证失败";
MessageBox.Show("DSAVerify:" txtResponse.Text);
CryptoHelper.RSAGetKey(out privateKey, out publicKey);
txtResponse.Text = CryptoHelper.RSAEncrypt(text, publicKey);
MessageBox.Show("RSAEncrypt:" txtResponse.Text);
txtResponse.Text = CryptoHelper.RSADecrypt(txtResponse.Text, privateKey);
MessageBox.Show("RSADecrypt:" txtResponse.Text);
txtResponse.Text = CryptoHelper.RSASign(text, privateKey);
MessageBox.Show("RSASign:" txtResponse.Text);
bool ok = CryptoHelper.RSAVerify(text, txtResponse.Text, publicKey);
txtResponse.Text = ok ? "验证成功" : "验证失败";
MessageBox.Show("RSAVerify:" txtResponse.Text);
txtResponse.Text = CryptoHelper.TripleDESEncrypt(text, "ABCDEFGHIJKLMNOP", "12345678");
MessageBox.Show(CryptoHelper.TripleDESDecrypt(txtResponse.Text, "ABCDEFGHIJKLMNOP", "12345678"));
txtResponse.Text = CryptoHelper.RijndaelEncrypt(text, "12345678", "12345678");
MessageBox.Show(CryptoHelper.RijndaelDecrypt(txtResponse.Text, "12345678", "12345678"));
txtResponse.Text = CryptoHelper.DESEncrypt(text, "12345678", "12345678");
MessageBox.Show(CryptoHelper.DESDecrypt(txtResponse.Text, "12345678", "12345678"));
//来源:C/S框架网(www.csframework.com) QQ:1980854898
string text = "www.csframework.com/www.cscode.net C/S框架网测试";
txtResponse.Text = CryptoHelper.ToMD5(text);
MessageBox.Show("ToMD5:" txtResponse.Text);
txtResponse.Text = CryptoHelper.ToSHA256Hash(text);
MessageBox.Show("ToSHA256Hash:" txtResponse.Text);
txtResponse.Text = CryptoHelper.ToSHA512Hash(text);
MessageBox.Show("ToSHA512Hash:" txtResponse.Text);
string privateKey; string publicKey;
CryptoHelper.DSAGetKey(out privateKey, out publicKey);
txtResponse.Text = CryptoHelper.DSASign(text, privateKey);
MessageBox.Show("DSASign:" txtResponse.Text);
bool ss = CryptoHelper.DSAVerify(text, txtResponse.Text, publicKey);
txtResponse.Text = ss ? "验证成功" : "验证失败";
MessageBox.Show("DSAVerify:" txtResponse.Text);
CryptoHelper.RSAGetKey(out privateKey, out publicKey);
txtResponse.Text = CryptoHelper.RSAEncrypt(text, publicKey);
MessageBox.Show("RSAEncrypt:" txtResponse.Text);
txtResponse.Text = CryptoHelper.RSADecrypt(txtResponse.Text, privateKey);
MessageBox.Show("RSADecrypt:" txtResponse.Text);
txtResponse.Text = CryptoHelper.RSASign(text, privateKey);
MessageBox.Show("RSASign:" txtResponse.Text);
bool ok = CryptoHelper.RSAVerify(text, txtResponse.Text, publicKey);
txtResponse.Text = ok ? "验证成功" : "验证失败";
MessageBox.Show("RSAVerify:" txtResponse.Text);
txtResponse.Text = CryptoHelper.TripleDESEncrypt(text, "ABCDEFGHIJKLMNOP", "12345678");
MessageBox.Show(CryptoHelper.TripleDESDecrypt(txtResponse.Text, "ABCDEFGHIJKLMNOP", "12345678"));
txtResponse.Text = CryptoHelper.RijndaelEncrypt(text, "12345678", "12345678");
MessageBox.Show(CryptoHelper.RijndaelDecrypt(txtResponse.Text, "12345678", "12345678"));
txtResponse.Text = CryptoHelper.DESEncrypt(text, "12345678", "12345678");
MessageBox.Show(CryptoHelper.DESDecrypt(txtResponse.Text, "12345678", "12345678"));
//来源:C/S框架网(www.csframework.com) QQ:1980854898
CryptoHelper.cs下载:

参考文档:
.NET Reactor(.NET混淆器)加壳软件使用|C/S开发框架
ASP.NET Web开发框架, B/S架构软件快速开发平台
微信小程序后端框架 | C# ASP.NET服务端WebApi快速开发框架平台
WebApi快速开发框架,C# ASP.NET后端开发平台
【原创】C# IKVM加密解密机AES对称加密模式AES-128-ECB,补码方式 PKCS5Padding
建议使用.NET Reactor进行DLL,EXE加密后再发布给用户使用
FastReport.NET自动文本宽度+自动换行+自动行高|C/S开发框架
FastReport.NET2023破解版去除水印DEMO VERSION (2025.1.14/2023.2.18版本)|C/S开发框架
C/S软件授权注册系统V3.0(Winform+WebApi+.NET8+EFCore版本)|C/S开发框架
.NET C/S架构软件用户授权设计方案(mac地址+白名单用户)|C/S开发框架
企业级C/S系统快速开发框架(Winform+.NET8+EFCore)|C/S开发框架
.NETCore WebApi运行报错:System.AggregateException:“Some services are not able to be constructed|C/S开发框架
C#.NET各版本常用语法糖大全(C#3~C#10)|C/S开发框架
CSFramework.EF数据库框架应用Schema测试多种数据库(.NET8+EFCore)|C/S开发框架
CSFrameworV6试用版开发指南 | 主程序初始化CSFramework.EF数据库框架(.NET8)|C/S开发框架
CSFramework开发框架使用.NET Reactor加壳软件导致多语言失效|C/S开发框架
.NET Reactor(.NET混淆器)加壳软件使用|C/S开发框架
ASP.NET Web开发框架, B/S架构软件快速开发平台
微信小程序后端框架 | C# ASP.NET服务端WebApi快速开发框架平台
WebApi快速开发框架,C# ASP.NET后端开发平台
【原创】C# IKVM加密解密机AES对称加密模式AES-128-ECB,补码方式 PKCS5Padding
建议使用.NET Reactor进行DLL,EXE加密后再发布给用户使用
FastReport.NET自动文本宽度+自动换行+自动行高|C/S开发框架
FastReport.NET2023破解版去除水印DEMO VERSION (2025.1.14/2023.2.18版本)|C/S开发框架
C/S软件授权注册系统V3.0(Winform+WebApi+.NET8+EFCore版本)|C/S开发框架
.NET C/S架构软件用户授权设计方案(mac地址+白名单用户)|C/S开发框架
企业级C/S系统快速开发框架(Winform+.NET8+EFCore)|C/S开发框架
.NETCore WebApi运行报错:System.AggregateException:“Some services are not able to be constructed|C/S开发框架
C#.NET各版本常用语法糖大全(C#3~C#10)|C/S开发框架
CSFramework.EF数据库框架应用Schema测试多种数据库(.NET8+EFCore)|C/S开发框架
CSFrameworV6试用版开发指南 | 主程序初始化CSFramework.EF数据库框架(.NET8)|C/S开发框架
CSFramework开发框架使用.NET Reactor加壳软件导致多语言失效|C/S开发框架
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
在线客服
