NewLife/XCoder

md5爆破算法完成
大石头 authored at 2021-05-09 11:19:12
3a38c74
Tree
1 Parent(s) 7591f94
Summary: 8 changed files with 891 additions and 13 deletions.
Modified +3 -3
Added +255 -0
Added +491 -0
Added +123 -0
Modified +12 -3
Modified +2 -2
Modified +3 -3
Modified +2 -2
Modified +3 -3
diff --git a/CrazyCoder/CrazyCoder.csproj b/CrazyCoder/CrazyCoder.csproj
index ed31cc8..328372f 100644
--- a/CrazyCoder/CrazyCoder.csproj
+++ b/CrazyCoder/CrazyCoder.csproj
@@ -117,13 +117,13 @@
       <Version>5.4.1.1</Version>
     </PackageReference>
     <PackageReference Include="NewLife.Core">
-      <Version>8.10.2021.427-beta1</Version>
+      <Version>8.10.2021.505</Version>
     </PackageReference>
     <PackageReference Include="NewLife.Stardust">
-      <Version>1.5.2021.427-beta1</Version>
+      <Version>1.5.2021.505</Version>
     </PackageReference>
     <PackageReference Include="NewLife.XCode">
-      <Version>10.1.2021.427-beta3</Version>
+      <Version>10.1.2021.505</Version>
     </PackageReference>
   </ItemGroup>
   <ItemGroup>
Added +255 -0
diff --git a/XCoder/Tools/FrmMD5.cs b/XCoder/Tools/FrmMD5.cs
new file mode 100644
index 0000000..2c2512f
--- /dev/null
+++ b/XCoder/Tools/FrmMD5.cs
@@ -0,0 +1,255 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using NewLife;
+using NewLife.Log;
+using NewLife.Serialization;
+
+namespace XCoder.Tools
+{
+    [DisplayName("MD5解密")]
+    public partial class FrmMD5 : Form, IXForm
+    {
+        #region 窗体初始化
+        public FrmMD5()
+        {
+            InitializeComponent();
+
+            // 动态调节宽度高度,兼容高DPI
+            this.FixDpi();
+        }
+
+        private void FrmSecurity_Load(Object sender, EventArgs e) => LoadConfig();
+
+        private void LoadConfig()
+        {
+            var dataPath = Setting.Current.DataPath;
+            var file = dataPath.CombinePath("md5.json").GetFullPath();
+            if (File.Exists(file))
+            {
+                var dic = new JsonParser(File.ReadAllText(file)).Decode() as IDictionary<String, Object>;
+                LoadConfig(dic, this);
+            }
+        }
+
+        private void LoadConfig(IDictionary<String, Object> dic, Control control)
+        {
+            foreach (Control item in control.Controls)
+            {
+                switch (item)
+                {
+                    case RadioButton rb:
+                        if (dic.TryGetValue(item.Name, out var v)) rb.Checked = v.ToBoolean();
+                        break;
+                    case CheckBox cb:
+                        if (dic.TryGetValue(item.Name, out v)) cb.Checked = v.ToBoolean();
+                        break;
+                    case RichTextBox rtb:
+                        if (dic.TryGetValue(item.Name, out v)) rtb.Text = v + "";
+                        break;
+                    default:
+                        if (item.Controls.Count > 0) LoadConfig(dic, item);
+                        break;
+                }
+            }
+        }
+
+        private void SaveConfig()
+        {
+            var dic = new Dictionary<String, Object>();
+            SaveConfig(dic, this);
+
+            var dataPath = Setting.Current.DataPath;
+            var file = dataPath.CombinePath("md5.json").GetFullPath();
+            file.EnsureDirectory(true);
+            File.WriteAllText(file, dic.ToJson(true));
+        }
+
+        private void SaveConfig(IDictionary<String, Object> dic, Control control)
+        {
+            foreach (Control item in control.Controls)
+            {
+                switch (item)
+                {
+                    case RadioButton rb: dic[item.Name] = rb.Checked; break;
+                    case CheckBox cb: dic[item.Name] = cb.Checked; break;
+                    case RichTextBox rtb: dic[item.Name] = rtb.Text; break;
+                    default:
+                        if (item.Controls.Count > 0) SaveConfig(dic, item);
+                        break;
+                }
+            }
+        }
+        #endregion
+
+        #region 辅助
+        /// <summary>从原文中获取字节数组</summary>
+        /// <returns></returns>
+        private Byte[] GetSource()
+        {
+            var v = rtSource.Text;
+
+            if (rbString.Checked) return v.GetBytes();
+            if (rbHex.Checked) return v.ToHex();
+            if (rbBase64.Checked) return v.ToBase64();
+
+            return null;
+        }
+
+        private void rtSource_TextChanged(Object sender, EventArgs e)
+        {
+            var v = rtSource.Text;
+            if (v.IsNullOrEmpty()) return;
+
+            // 单字节
+            var enc = Encoding.UTF8;
+            if (enc.GetByteCount(v) != v.Length)
+            {
+                rbHex.Enabled = false;
+                rbBase64.Enabled = false;
+                return;
+            }
+
+            try
+            {
+                rbHex.Enabled = v.ToHex().Length > 0;
+            }
+            catch
+            {
+                rbHex.Enabled = false;
+            }
+
+            try
+            {
+                rbBase64.Enabled = v.ToBase64().Length > 0;
+            }
+            catch
+            {
+                rbBase64.Enabled = false;
+            }
+        }
+        #endregion
+
+        #region 功能
+        private String GetChars()
+        {
+            var length = (Int32)numLength.Value;
+
+            // 可用字符
+            var sb = new StringBuilder();
+            if (cbNumber.Checked)
+            {
+                for (var c = '0'; c <= '9'; c++)
+                    sb.Append(c);
+            }
+            if (cbCharLower.Checked)
+            {
+                for (var c = 'a'; c <= 'z'; c++)
+                    sb.Append(c);
+            }
+            if (cbCharUpper.Checked)
+            {
+                for (var c = 'A'; c <= 'Z'; c++)
+                    sb.Append(c);
+            }
+            if (cbSymbol.Checked)
+            {
+                for (var c = ' '; c <= '/'; c++)
+                    sb.Append(c);
+                for (var c = ':'; c <= '@'; c++)
+                    sb.Append(c);
+                for (var c = '['; c <= '\''; c++)
+                    sb.Append(c);
+                for (var c = '{'; c <= '~'; c++)
+                    sb.Append(c);
+            }
+
+            // 总计算量
+            var total = (Int64)Math.Pow(sb.Length, length);
+            lbTotal.Text = total.ToString("n0");
+
+            return sb.ToString();
+        }
+
+        private async void btnMD5_Click(Object sender, EventArgs e)
+        {
+            SaveConfig();
+
+            var chars = GetChars();
+            var buf = GetSource();
+            var result = buf.ToStr().ToUpper();
+
+            var length = (Int32)numLength.Value;
+            var total = (Int64)Math.Pow(chars.Length, length);
+            var cpu = Environment.ProcessorCount;
+            var step = total / cpu;
+
+            var btn = sender as Button;
+            btn.Enabled = false;
+
+            try
+            {
+                //var source = new TaskCompletionSource<String>();
+                var cts = new CancellationTokenSource();
+                var ts = new List<Task<String>>();
+                for (var i = 0; i < cpu; i++)
+                {
+                    var start = i * step;
+                    if (!cts.Token.IsCancellationRequested)
+                        ts.Add(Task.Run(() => DoWork(result, chars, length, start, start + step, cts)));
+                }
+
+                var rs = await Task.WhenAll(ts);
+
+                rtResult.Text = rs.Where(e => e != null).Join(Environment.NewLine);
+            }
+            finally
+            {
+                btn.Enabled = true;
+            }
+        }
+
+        private String DoWork(String result, String cs, Int32 length, Int64 start, Int64 end, CancellationTokenSource cts)
+        {
+            XTrace.WriteLine("可用字符串:{0},长度:{1},区间({2:n0} {3:n0})", cs.Length, length, start, end);
+
+            // 需要把数字转为密码字符串
+            // 第0个字符串应该是 000000
+            var txt = new Char[length];
+
+            for (var i = start; i < end && !cts.Token.IsCancellationRequested; i++)
+            {
+                // 生成字符串。倒序,逐级取余,得到字符
+                var n = i;
+                for (var j = length - 1; j >= 0; j--)
+                {
+                    n = Math.DivRem(n, cs.Length, out var rs);
+
+                    txt[j] = cs[(Int32)rs];
+                }
+
+                var pass = new String(txt);
+                if (pass.MD5() == result)
+                {
+                    XTrace.WriteLine("发现密码:{0}", pass);
+                    cts.Cancel();
+                    return pass;
+                }
+            }
+
+            return null;
+        }
+        #endregion
+
+        private void numLength_ValueChanged(Object sender, EventArgs e)
+        {
+            var chars = GetChars();
+        }
+    }
+}
\ No newline at end of file
Added +491 -0
diff --git a/XCoder/Tools/FrmMD5.Designer.cs b/XCoder/Tools/FrmMD5.Designer.cs
new file mode 100644
index 0000000..a77d3d4
--- /dev/null
+++ b/XCoder/Tools/FrmMD5.Designer.cs
@@ -0,0 +1,491 @@
+namespace XCoder.Tools
+{
+    partial class FrmMD5
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.gbFunc = new System.Windows.Forms.GroupBox();
+            this.lbProgress = new System.Windows.Forms.Label();
+            this.label7 = new System.Windows.Forms.Label();
+            this.lbPosition = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.lbTotal = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.cbSymbol = new System.Windows.Forms.CheckBox();
+            this.cbCharUpper = new System.Windows.Forms.CheckBox();
+            this.cbCharLower = new System.Windows.Forms.CheckBox();
+            this.cbNumber = new System.Windows.Forms.CheckBox();
+            this.numLength = new System.Windows.Forms.NumericUpDown();
+            this.label1 = new System.Windows.Forms.Label();
+            this.btnMD5 = new System.Windows.Forms.Button();
+            this.gbSource = new System.Windows.Forms.GroupBox();
+            this.rtSource = new System.Windows.Forms.RichTextBox();
+            this.gbResult = new System.Windows.Forms.GroupBox();
+            this.cbBase64 = new System.Windows.Forms.CheckBox();
+            this.cbHex = new System.Windows.Forms.CheckBox();
+            this.cbString = new System.Windows.Forms.CheckBox();
+            this.rtResult = new System.Windows.Forms.RichTextBox();
+            this.gbPass = new System.Windows.Forms.GroupBox();
+            this.rbBase642 = new System.Windows.Forms.RadioButton();
+            this.rbHex2 = new System.Windows.Forms.RadioButton();
+            this.rbString2 = new System.Windows.Forms.RadioButton();
+            this.rtPass = new System.Windows.Forms.RichTextBox();
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.rbBase64 = new System.Windows.Forms.RadioButton();
+            this.rbHex = new System.Windows.Forms.RadioButton();
+            this.rbString = new System.Windows.Forms.RadioButton();
+            this.gbFunc.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.numLength)).BeginInit();
+            this.gbSource.SuspendLayout();
+            this.gbResult.SuspendLayout();
+            this.gbPass.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // gbFunc
+            // 
+            this.gbFunc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.gbFunc.Controls.Add(this.lbProgress);
+            this.gbFunc.Controls.Add(this.label7);
+            this.gbFunc.Controls.Add(this.lbPosition);
+            this.gbFunc.Controls.Add(this.label5);
+            this.gbFunc.Controls.Add(this.lbTotal);
+            this.gbFunc.Controls.Add(this.label2);
+            this.gbFunc.Controls.Add(this.cbSymbol);
+            this.gbFunc.Controls.Add(this.cbCharUpper);
+            this.gbFunc.Controls.Add(this.cbCharLower);
+            this.gbFunc.Controls.Add(this.cbNumber);
+            this.gbFunc.Controls.Add(this.numLength);
+            this.gbFunc.Controls.Add(this.label1);
+            this.gbFunc.Controls.Add(this.btnMD5);
+            this.gbFunc.Location = new System.Drawing.Point(18, 18);
+            this.gbFunc.Margin = new System.Windows.Forms.Padding(4);
+            this.gbFunc.Name = "gbFunc";
+            this.gbFunc.Padding = new System.Windows.Forms.Padding(4);
+            this.gbFunc.Size = new System.Drawing.Size(258, 908);
+            this.gbFunc.TabIndex = 0;
+            this.gbFunc.TabStop = false;
+            this.gbFunc.Text = "加密解密";
+            // 
+            // lbProgress
+            // 
+            this.lbProgress.AutoSize = true;
+            this.lbProgress.ForeColor = System.Drawing.Color.Red;
+            this.lbProgress.Location = new System.Drawing.Point(100, 267);
+            this.lbProgress.Name = "lbProgress";
+            this.lbProgress.Size = new System.Drawing.Size(53, 18);
+            this.lbProgress.TabIndex = 16;
+            this.lbProgress.Text = "0.00%";
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(7, 267);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(98, 18);
+            this.label7.TabIndex = 15;
+            this.label7.Text = "计算进度:";
+            // 
+            // lbPosition
+            // 
+            this.lbPosition.AutoSize = true;
+            this.lbPosition.ForeColor = System.Drawing.Color.Red;
+            this.lbPosition.Location = new System.Drawing.Point(100, 235);
+            this.lbPosition.Name = "lbPosition";
+            this.lbPosition.Size = new System.Drawing.Size(17, 18);
+            this.lbPosition.TabIndex = 14;
+            this.lbPosition.Text = "0";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(7, 235);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(98, 18);
+            this.label5.TabIndex = 13;
+            this.label5.Text = "当前位置:";
+            // 
+            // lbTotal
+            // 
+            this.lbTotal.AutoSize = true;
+            this.lbTotal.ForeColor = System.Drawing.Color.Red;
+            this.lbTotal.Location = new System.Drawing.Point(100, 202);
+            this.lbTotal.Name = "lbTotal";
+            this.lbTotal.Size = new System.Drawing.Size(89, 18);
+            this.lbTotal.TabIndex = 12;
+            this.lbTotal.Text = "1,000,000";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(7, 202);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(98, 18);
+            this.label2.TabIndex = 11;
+            this.label2.Text = "总计算量:";
+            // 
+            // cbSymbol
+            // 
+            this.cbSymbol.AutoSize = true;
+            this.cbSymbol.Location = new System.Drawing.Point(100, 154);
+            this.cbSymbol.Name = "cbSymbol";
+            this.cbSymbol.Size = new System.Drawing.Size(106, 22);
+            this.cbSymbol.TabIndex = 10;
+            this.cbSymbol.Text = "特殊符号";
+            this.cbSymbol.UseVisualStyleBackColor = true;
+            this.cbSymbol.CheckedChanged += new System.EventHandler(this.numLength_ValueChanged);
+            // 
+            // cbCharUpper
+            // 
+            this.cbCharUpper.AutoSize = true;
+            this.cbCharUpper.Location = new System.Drawing.Point(100, 126);
+            this.cbCharUpper.Name = "cbCharUpper";
+            this.cbCharUpper.Size = new System.Drawing.Size(106, 22);
+            this.cbCharUpper.TabIndex = 9;
+            this.cbCharUpper.Text = "大写字母";
+            this.cbCharUpper.UseVisualStyleBackColor = true;
+            this.cbCharUpper.CheckedChanged += new System.EventHandler(this.numLength_ValueChanged);
+            // 
+            // cbCharLower
+            // 
+            this.cbCharLower.AutoSize = true;
+            this.cbCharLower.Location = new System.Drawing.Point(100, 98);
+            this.cbCharLower.Name = "cbCharLower";
+            this.cbCharLower.Size = new System.Drawing.Size(106, 22);
+            this.cbCharLower.TabIndex = 8;
+            this.cbCharLower.Text = "小写字母";
+            this.cbCharLower.UseVisualStyleBackColor = true;
+            this.cbCharLower.CheckedChanged += new System.EventHandler(this.numLength_ValueChanged);
+            // 
+            // cbNumber
+            // 
+            this.cbNumber.AutoSize = true;
+            this.cbNumber.Checked = true;
+            this.cbNumber.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.cbNumber.Location = new System.Drawing.Point(100, 70);
+            this.cbNumber.Name = "cbNumber";
+            this.cbNumber.Size = new System.Drawing.Size(70, 22);
+            this.cbNumber.TabIndex = 7;
+            this.cbNumber.Text = "数字";
+            this.cbNumber.UseVisualStyleBackColor = true;
+            this.cbNumber.CheckedChanged += new System.EventHandler(this.numLength_ValueChanged);
+            // 
+            // numLength
+            // 
+            this.numLength.Location = new System.Drawing.Point(100, 26);
+            this.numLength.Name = "numLength";
+            this.numLength.Size = new System.Drawing.Size(94, 28);
+            this.numLength.TabIndex = 6;
+            this.numLength.Value = new decimal(new int[] {
+            6,
+            0,
+            0,
+            0});
+            this.numLength.ValueChanged += new System.EventHandler(this.numLength_ValueChanged);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(7, 31);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(98, 18);
+            this.label1.TabIndex = 5;
+            this.label1.Text = "密码位数:";
+            // 
+            // btnMD5
+            // 
+            this.btnMD5.Location = new System.Drawing.Point(53, 299);
+            this.btnMD5.Margin = new System.Windows.Forms.Padding(4);
+            this.btnMD5.Name = "btnMD5";
+            this.btnMD5.Size = new System.Drawing.Size(112, 45);
+            this.btnMD5.TabIndex = 4;
+            this.btnMD5.Text = "MD5爆破";
+            this.btnMD5.UseVisualStyleBackColor = true;
+            this.btnMD5.Click += new System.EventHandler(this.btnMD5_Click);
+            // 
+            // gbSource
+            // 
+            this.gbSource.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.gbSource.Controls.Add(this.rbBase64);
+            this.gbSource.Controls.Add(this.rbHex);
+            this.gbSource.Controls.Add(this.rbString);
+            this.gbSource.Controls.Add(this.rtSource);
+            this.gbSource.Location = new System.Drawing.Point(285, 18);
+            this.gbSource.Margin = new System.Windows.Forms.Padding(4);
+            this.gbSource.Name = "gbSource";
+            this.gbSource.Padding = new System.Windows.Forms.Padding(4);
+            this.gbSource.Size = new System.Drawing.Size(1006, 375);
+            this.gbSource.TabIndex = 3;
+            this.gbSource.TabStop = false;
+            this.gbSource.Text = "原文";
+            // 
+            // rtSource
+            // 
+            this.rtSource.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.rtSource.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rtSource.Location = new System.Drawing.Point(4, 65);
+            this.rtSource.Margin = new System.Windows.Forms.Padding(4);
+            this.rtSource.Name = "rtSource";
+            this.rtSource.Size = new System.Drawing.Size(998, 306);
+            this.rtSource.TabIndex = 2;
+            this.rtSource.Text = "4c5fca3ed14e45d865d31b780a7bd40c";
+            this.rtSource.TextChanged += new System.EventHandler(this.rtSource_TextChanged);
+            // 
+            // gbResult
+            // 
+            this.gbResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.gbResult.Controls.Add(this.cbBase64);
+            this.gbResult.Controls.Add(this.cbHex);
+            this.gbResult.Controls.Add(this.cbString);
+            this.gbResult.Controls.Add(this.rtResult);
+            this.gbResult.Location = new System.Drawing.Point(285, 552);
+            this.gbResult.Margin = new System.Windows.Forms.Padding(4);
+            this.gbResult.Name = "gbResult";
+            this.gbResult.Padding = new System.Windows.Forms.Padding(4);
+            this.gbResult.Size = new System.Drawing.Size(1006, 375);
+            this.gbResult.TabIndex = 4;
+            this.gbResult.TabStop = false;
+            this.gbResult.Text = "结果";
+            // 
+            // cbBase64
+            // 
+            this.cbBase64.AutoSize = true;
+            this.cbBase64.Checked = true;
+            this.cbBase64.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.cbBase64.Location = new System.Drawing.Point(299, 28);
+            this.cbBase64.Margin = new System.Windows.Forms.Padding(2);
+            this.cbBase64.Name = "cbBase64";
+            this.cbBase64.Size = new System.Drawing.Size(124, 22);
+            this.cbBase64.TabIndex = 8;
+            this.cbBase64.Text = "BASE64编码";
+            this.cbBase64.UseVisualStyleBackColor = true;
+            // 
+            // cbHex
+            // 
+            this.cbHex.AutoSize = true;
+            this.cbHex.Checked = true;
+            this.cbHex.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.cbHex.Location = new System.Drawing.Point(154, 28);
+            this.cbHex.Margin = new System.Windows.Forms.Padding(2);
+            this.cbHex.Name = "cbHex";
+            this.cbHex.Size = new System.Drawing.Size(97, 22);
+            this.cbHex.TabIndex = 7;
+            this.cbHex.Text = "HEX编码";
+            this.cbHex.UseVisualStyleBackColor = true;
+            // 
+            // cbString
+            // 
+            this.cbString.AutoSize = true;
+            this.cbString.Checked = true;
+            this.cbString.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.cbString.Location = new System.Drawing.Point(19, 28);
+            this.cbString.Margin = new System.Windows.Forms.Padding(2);
+            this.cbString.Name = "cbString";
+            this.cbString.Size = new System.Drawing.Size(88, 22);
+            this.cbString.TabIndex = 6;
+            this.cbString.Text = "字符串";
+            this.cbString.UseVisualStyleBackColor = true;
+            // 
+            // rtResult
+            // 
+            this.rtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.rtResult.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rtResult.Location = new System.Drawing.Point(4, 57);
+            this.rtResult.Margin = new System.Windows.Forms.Padding(4);
+            this.rtResult.Name = "rtResult";
+            this.rtResult.Size = new System.Drawing.Size(998, 314);
+            this.rtResult.TabIndex = 2;
+            this.rtResult.Text = "";
+            // 
+            // gbPass
+            // 
+            this.gbPass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.gbPass.Controls.Add(this.rbBase642);
+            this.gbPass.Controls.Add(this.rbHex2);
+            this.gbPass.Controls.Add(this.rbString2);
+            this.gbPass.Controls.Add(this.rtPass);
+            this.gbPass.Location = new System.Drawing.Point(285, 398);
+            this.gbPass.Margin = new System.Windows.Forms.Padding(4);
+            this.gbPass.Name = "gbPass";
+            this.gbPass.Padding = new System.Windows.Forms.Padding(4);
+            this.gbPass.Size = new System.Drawing.Size(1006, 150);
+            this.gbPass.TabIndex = 5;
+            this.gbPass.TabStop = false;
+            this.gbPass.Text = "密码";
+            // 
+            // rbBase642
+            // 
+            this.rbBase642.AutoSize = true;
+            this.rbBase642.Location = new System.Drawing.Point(299, 30);
+            this.rbBase642.Margin = new System.Windows.Forms.Padding(2);
+            this.rbBase642.Name = "rbBase642";
+            this.rbBase642.Size = new System.Drawing.Size(123, 22);
+            this.rbBase642.TabIndex = 8;
+            this.rbBase642.Text = "BASE64编码";
+            this.rbBase642.UseVisualStyleBackColor = true;
+            // 
+            // rbHex2
+            // 
+            this.rbHex2.AutoSize = true;
+            this.rbHex2.Location = new System.Drawing.Point(155, 30);
+            this.rbHex2.Margin = new System.Windows.Forms.Padding(2);
+            this.rbHex2.Name = "rbHex2";
+            this.rbHex2.Size = new System.Drawing.Size(96, 22);
+            this.rbHex2.TabIndex = 7;
+            this.rbHex2.Text = "HEX编码";
+            this.rbHex2.UseVisualStyleBackColor = true;
+            // 
+            // rbString2
+            // 
+            this.rbString2.AutoSize = true;
+            this.rbString2.Checked = true;
+            this.rbString2.Location = new System.Drawing.Point(19, 30);
+            this.rbString2.Margin = new System.Windows.Forms.Padding(2);
+            this.rbString2.Name = "rbString2";
+            this.rbString2.Size = new System.Drawing.Size(87, 22);
+            this.rbString2.TabIndex = 6;
+            this.rbString2.TabStop = true;
+            this.rbString2.Text = "字符串";
+            this.rbString2.UseVisualStyleBackColor = true;
+            // 
+            // rtPass
+            // 
+            this.rtPass.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.rtPass.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rtPass.Location = new System.Drawing.Point(4, 64);
+            this.rtPass.Margin = new System.Windows.Forms.Padding(4);
+            this.rtPass.Name = "rtPass";
+            this.rtPass.Size = new System.Drawing.Size(998, 82);
+            this.rtPass.TabIndex = 2;
+            this.rtPass.Text = "NewLife";
+            // 
+            // rbBase64
+            // 
+            this.rbBase64.AutoSize = true;
+            this.rbBase64.Location = new System.Drawing.Point(299, 28);
+            this.rbBase64.Margin = new System.Windows.Forms.Padding(2);
+            this.rbBase64.Name = "rbBase64";
+            this.rbBase64.Size = new System.Drawing.Size(123, 22);
+            this.rbBase64.TabIndex = 5;
+            this.rbBase64.Text = "BASE64编码";
+            this.rbBase64.UseVisualStyleBackColor = true;
+            // 
+            // rbHex
+            // 
+            this.rbHex.AutoSize = true;
+            this.rbHex.Location = new System.Drawing.Point(154, 28);
+            this.rbHex.Margin = new System.Windows.Forms.Padding(2);
+            this.rbHex.Name = "rbHex";
+            this.rbHex.Size = new System.Drawing.Size(96, 22);
+            this.rbHex.TabIndex = 4;
+            this.rbHex.Text = "HEX编码";
+            this.rbHex.UseVisualStyleBackColor = true;
+            // 
+            // rbString
+            // 
+            this.rbString.AutoSize = true;
+            this.rbString.Checked = true;
+            this.rbString.Location = new System.Drawing.Point(19, 28);
+            this.rbString.Margin = new System.Windows.Forms.Padding(2);
+            this.rbString.Name = "rbString";
+            this.rbString.Size = new System.Drawing.Size(87, 22);
+            this.rbString.TabIndex = 3;
+            this.rbString.TabStop = true;
+            this.rbString.Text = "字符串";
+            this.rbString.UseVisualStyleBackColor = true;
+            // 
+            // FrmMD5
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1304, 944);
+            this.Controls.Add(this.gbPass);
+            this.Controls.Add(this.gbResult);
+            this.Controls.Add(this.gbSource);
+            this.Controls.Add(this.gbFunc);
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Name = "FrmMD5";
+            this.Text = "MD5解密";
+            this.Load += new System.EventHandler(this.FrmSecurity_Load);
+            this.gbFunc.ResumeLayout(false);
+            this.gbFunc.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.numLength)).EndInit();
+            this.gbSource.ResumeLayout(false);
+            this.gbSource.PerformLayout();
+            this.gbResult.ResumeLayout(false);
+            this.gbResult.PerformLayout();
+            this.gbPass.ResumeLayout(false);
+            this.gbPass.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.GroupBox gbFunc;
+        private System.Windows.Forms.GroupBox gbSource;
+        private System.Windows.Forms.RichTextBox rtSource;
+        private System.Windows.Forms.GroupBox gbResult;
+        private System.Windows.Forms.RichTextBox rtResult;
+        private System.Windows.Forms.Button btnMD5;
+        private System.Windows.Forms.GroupBox gbPass;
+        private System.Windows.Forms.RichTextBox rtPass;
+        private System.Windows.Forms.CheckBox cbBase64;
+        private System.Windows.Forms.CheckBox cbHex;
+        private System.Windows.Forms.CheckBox cbString;
+        private System.Windows.Forms.RadioButton rbBase642;
+        private System.Windows.Forms.RadioButton rbHex2;
+        private System.Windows.Forms.RadioButton rbString2;
+        private System.Windows.Forms.Label lbTotal;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.CheckBox cbSymbol;
+        private System.Windows.Forms.CheckBox cbCharUpper;
+        private System.Windows.Forms.CheckBox cbCharLower;
+        private System.Windows.Forms.CheckBox cbNumber;
+        private System.Windows.Forms.NumericUpDown numLength;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label lbProgress;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.Label lbPosition;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Timer timer1;
+        private System.Windows.Forms.RadioButton rbBase64;
+        private System.Windows.Forms.RadioButton rbHex;
+        private System.Windows.Forms.RadioButton rbString;
+    }
+}
\ No newline at end of file
Added +123 -0
diff --git a/XCoder/Tools/FrmMD5.resx b/XCoder/Tools/FrmMD5.resx
new file mode 100644
index 0000000..1f666f2
--- /dev/null
+++ b/XCoder/Tools/FrmMD5.resx
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>
\ No newline at end of file
Modified +12 -3
diff --git a/XCoder/XCoder.csproj b/XCoder/XCoder.csproj
index 3627858..bfec50d 100644
--- a/XCoder/XCoder.csproj
+++ b/XCoder/XCoder.csproj
@@ -82,6 +82,12 @@
       <DependentUpon>FrmMDI.cs</DependentUpon>
     </Compile>
     <Compile Include="IXForm.cs" />
+    <Compile Include="Tools\FrmMD5.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Tools\FrmMD5.Designer.cs">
+      <DependentUpon>FrmMD5.cs</DependentUpon>
+    </Compile>
     <Compile Include="Tools\FrmSecurity.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -186,6 +192,9 @@
     <EmbeddedResource Include="FrmMDI.resx">
       <DependentUpon>FrmMDI.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Tools\FrmMD5.resx">
+      <DependentUpon>FrmMD5.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Tools\FrmSecurity.resx">
       <DependentUpon>FrmSecurity.cs</DependentUpon>
     </EmbeddedResource>
@@ -310,16 +319,16 @@
   </ItemGroup>
   <ItemGroup>
     <PackageReference Include="NewLife.Core">
-      <Version>8.10.2021.427-beta1</Version>
+      <Version>8.10.2021.505</Version>
     </PackageReference>
     <PackageReference Include="NewLife.Net">
       <Version>3.6.2020.1002</Version>
     </PackageReference>
     <PackageReference Include="NewLife.Stardust">
-      <Version>1.5.2021.427-beta1</Version>
+      <Version>1.5.2021.505</Version>
     </PackageReference>
     <PackageReference Include="NewLife.XCode">
-      <Version>10.1.2021.427-beta3</Version>
+      <Version>10.1.2021.505</Version>
     </PackageReference>
   </ItemGroup>
   <ItemGroup>
Modified +2 -2
diff --git a/XCoder40/XCoder40.csproj b/XCoder40/XCoder40.csproj
index cf38b6c..b75f61f 100644
--- a/XCoder40/XCoder40.csproj
+++ b/XCoder40/XCoder40.csproj
@@ -388,13 +388,13 @@
   </ItemGroup>
   <ItemGroup>
     <PackageReference Include="NewLife.Core">
-      <Version>8.10.2021.427-beta1</Version>
+      <Version>8.10.2021.505</Version>
     </PackageReference>
     <PackageReference Include="NewLife.Net">
       <Version>3.6.2020.1002</Version>
     </PackageReference>
     <PackageReference Include="NewLife.XCode">
-      <Version>10.1.2021.427-beta3</Version>
+      <Version>10.1.2021.505</Version>
     </PackageReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Modified +3 -3
diff --git a/XCoderLinux/XCoderLinux.csproj b/XCoderLinux/XCoderLinux.csproj
index e595036..953315e 100644
--- a/XCoderLinux/XCoderLinux.csproj
+++ b/XCoderLinux/XCoderLinux.csproj
@@ -47,9 +47,9 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="GtkSharp" Version="3.24.24.4" />
-    <PackageReference Include="NewLife.Core" Version="8.10.2021.427-beta1" />
-    <PackageReference Include="NewLife.XCode" Version="10.1.2021.427-beta3" />
+    <PackageReference Include="GtkSharp" Version="3.24.24.34" />
+    <PackageReference Include="NewLife.Core" Version="8.10.2021.505" />
+    <PackageReference Include="NewLife.XCode" Version="10.1.2021.505" />
     <PackageReference Include="System.IO.Ports" Version="5.0.1" />
     <PackageReference Include="System.Management" Version="5.0.0" />
   </ItemGroup>
Modified +2 -2
diff --git a/XCoderWpf/XCoderWpf.csproj b/XCoderWpf/XCoderWpf.csproj
index 5393592..f09fa3a 100644
--- a/XCoderWpf/XCoderWpf.csproj
+++ b/XCoderWpf/XCoderWpf.csproj
@@ -29,9 +29,9 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="HandyControls" Version="3.2.0" />
+    <PackageReference Include="HandyControls" Version="3.3.5" />
     <PackageReference Include="Microsoft.Data.SqlClient" Version="2.1.2" />
-    <PackageReference Include="NewLife.XCode" Version="10.1.2021.427-beta3" />
+    <PackageReference Include="NewLife.XCode" Version="10.1.2021.505" />
     <PackageReference Include="Prism.DryIoc" Version="8.0.0.1909" />
   </ItemGroup>