工具箱相关
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Form1.cs 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Security.Cryptography;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace Regest
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. string jqm = textBox2.Text;
  23. jqm = jqm +"," + workdays.Text;
  24. DESCryptoServiceProvider des = new DESCryptoServiceProvider();
  25. byte[] inputByteArray = Encoding.Default.GetBytes(jqm);
  26. des.Key = ASCIIEncoding.ASCII.GetBytes("vnf4s3ru");// 密钥
  27. des.IV = ASCIIEncoding.ASCII.GetBytes("vnf4s3ru");// 初始化向量
  28. MemoryStream ms = new MemoryStream();
  29. CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
  30. cs.Write(inputByteArray, 0, inputByteArray.Length);
  31. cs.FlushFinalBlock();
  32. var retB = Convert.ToBase64String(ms.ToArray());
  33. textBox1.Text = retB;
  34. }
  35. }
  36. }