91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 27KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-16
  • 語言: C#
  • 標簽: C#??DESC??

資源簡介

C#寫的一個DESC加密測試,可直接運行,注釋清楚,代碼簡單。另外C#還有幾種其他加密方式,如MD5不可逆加密,對稱加密等,有興趣可取看看,簡單

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Security.Cryptography;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;

namespace?加密
{
????public?partial?class?Form1?:?Form
????{

????????public?const?string?Key?=?“mallpark“;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????///?
????????///?加密
????????///?

????????///?
????????///?
????????private?void?btnEn_Click(object?sender?EventArgs?e)
????????{
????????????
????????????txtDE.Text?=?Encrypt(txtEN.Text?Key);
????????}

????????///?
????????///?解密
????????///?

????????///?
????????///?
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????txtDE.Text?=?Decrypt(txtEN.Text?Key);
????????}???

????????///?
????????///?進行DES加密。
????????///?

????????///?要加密的字符串。
????????///?密鑰,且必須為8位。
????????///?以base64格式返回的加密字符串。
????????string?Encrypt(string?pToEncrypt?string?sKey)
????????{
????????????if?(pToEncrypt?==?““)
????????????????return?““;
????????????try
????????????{
????????????????using?(DESCryptoServiceProvider?des?=?new?DESCryptoServiceProvider())
????????????????{
????????????????????byte[]?inputByteArray?=?Encoding.UTF8.GetBytes(pToEncrypt);
????????????????????des.Key?=?ASCIIEncoding.ASCII.GetBytes(sKey);
????????????????????des.IV?=?ASCIIEncoding.ASCII.GetBytes(sKey);
????????????????????System.IO.MemoryStream?ms?=?new?System.IO.MemoryStream();
????????????????????using?(CryptoStream?cs?=?new?CryptoStream(ms?des.CreateEncryptor()?CryptoStreamMode.Write))
????????????????????{
????????????????????????cs.Write(inputByteArray?0?inputByteArray.Length);
????????????????????????cs.FlushFinalBlock();
????????????????????????cs.Close();
????????????????????}
????????????????????string?str?=?Convert.Tobase64String(ms.ToArray());
????????????????????ms.Close();
????????????????????return?str;
????????????????}
????????????}
????????????catch
????????????{
????????????????return?“該字符串無法加密“;
????????????}
????????}

????????///?
????????///?進行DES解密。
????????///?

????????///?要解密的以base64
????????///?密鑰,且必須為8位。
????????///?已解密的字符串。
?????????string?Decrypt(string?pToDecrypt?string?sKey)
????????{
????????????if?(pToDecrypt?==?““)
????????????????return?““;
????????????try
????????????{
????????????????using?(DESCryptoServiceProvider?des?=?new?DESCryptoServiceProvider())
????????????????{
????????????????????byte[]?inputByteArray?=?Convert.Frombase64String(pToDecrypt);
?????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????167??2018-12-27?03:31??加密\App.config
?????目錄???????????0??2018-12-27?03:35??加密\bin\
?????文件????????3985??2018-12-27?03:31??加密\Form1.cs
?????文件????????4626??2018-12-27?03:31??加密\Form1.Designer.cs
?????文件????????5817??2018-12-27?03:31??加密\Form1.resx
?????目錄???????????0??2018-12-27?03:31??加密\obj\
?????目錄???????????0??2018-12-27?03:32??加密\obj\Debug\
?????文件?????????865??2018-12-27?03:32??加密\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6825??2018-12-27?03:32??加密\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????目錄???????????0??2018-12-27?03:32??加密\obj\Debug\TempPE\
?????文件????????4608??2018-12-27?03:32??加密\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????1185??2018-12-27?03:34??加密\obj\Debug\加解密.csproj.FileListAbsolute.txt
?????文件?????????977??2018-12-27?03:32??加密\obj\Debug\加解密.csproj.GenerateResource.Cache
?????文件????????2211??2018-12-27?03:32??加密\obj\Debug\加解密.csprojResolveAssemblyReference.cache
?????文件???????10752??2018-12-27?03:32??加密\obj\Debug\加密.exe
?????文件?????????180??2018-12-27?03:31??加密\obj\Debug\加密.Form1.resources
?????文件???????28160??2018-12-27?03:32??加密\obj\Debug\加密.pdb
?????文件?????????180??2018-12-27?03:31??加密\obj\Debug\加密.Properties.Resources.resources
?????文件?????????518??2018-12-27?03:31??加密\Program.cs
?????目錄???????????0??2018-12-27?03:31??加密\Properties\
?????文件????????1350??2018-12-27?03:31??加密\Properties\AssemblyInfo.cs
?????文件????????2852??2018-12-27?03:31??加密\Properties\Resources.Designer.cs
?????文件????????5612??2018-12-27?03:31??加密\Properties\Resources.resx
?????文件????????1106??2018-12-27?03:31??加密\Properties\Settings.Designer.cs
?????文件?????????249??2018-12-27?03:31??加密\Properties\Settings.settings
?????文件????????3857??2018-12-27?03:31??加密\加解密.csproj
?????文件????????3584??2018-12-27?03:35??加密\加解密.v12.suo

評論

共有 條評論