bastien.monsarrat 6 年之前
父节点
当前提交
aaa36049b3
共有 7 个文件被更改,包括 126 次插入0 次删除
  1. 12 0
      Adv2016.sln
  2. 9 0
      D05.1/D05.1.csproj
  3. 35 0
      D05.1/Program.cs
  4. 8 0
      D05.1/Properties/launchSettings.json
  5. 9 0
      D05.2/D05.2.csproj
  6. 45 0
      D05.2/Program.cs
  7. 8 0
      D05.2/Properties/launchSettings.json

+ 12 - 0
Adv2016.sln

@@ -19,6 +19,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D04.1", "D04.1\D04.1.csproj
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D04.2", "D04.2\D04.2.csproj", "{453AB88F-605E-40A8-B73F-1D1EE6BA852D}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D05.1", "D05.1\D05.1.csproj", "{54C11F9D-9DCB-4743-BED9-11CAF123837D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D05.2", "D05.2\D05.2.csproj", "{A49B7DDA-4DC5-4392-B4E7-1AF59E4BEB90}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -57,6 +61,14 @@ Global
 		{453AB88F-605E-40A8-B73F-1D1EE6BA852D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{453AB88F-605E-40A8-B73F-1D1EE6BA852D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{453AB88F-605E-40A8-B73F-1D1EE6BA852D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{54C11F9D-9DCB-4743-BED9-11CAF123837D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{54C11F9D-9DCB-4743-BED9-11CAF123837D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{54C11F9D-9DCB-4743-BED9-11CAF123837D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{54C11F9D-9DCB-4743-BED9-11CAF123837D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A49B7DDA-4DC5-4392-B4E7-1AF59E4BEB90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A49B7DDA-4DC5-4392-B4E7-1AF59E4BEB90}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A49B7DDA-4DC5-4392-B4E7-1AF59E4BEB90}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A49B7DDA-4DC5-4392-B4E7-1AF59E4BEB90}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 9 - 0
D05.1/D05.1.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <RootNamespace>D05._1</RootNamespace>
+  </PropertyGroup>
+
+</Project>

+ 35 - 0
D05.1/Program.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace D05._1
+{
+    class Program
+    {
+        static byte[] ToB(string str) => Encoding.ASCII.GetBytes(str);
+        static string ToS(byte[] b) => BitConverter.ToString(b).Replace("-", "");
+
+        static void Main(string[] args)
+        {
+            if (args.Length < 1) throw new ArgumentException();
+            string input = args[0];
+
+            var sb = new StringBuilder();
+
+            using (var md5 = MD5.Create())
+            {
+                int i = 0;
+                while (sb.Length < 8)
+                {
+                    var h = md5.ComputeHash(ToB($"{input}{i}"));
+                    var sh = ToS(h);
+                    if (sh.StartsWith("00000")) sb.Append(sh[5]);
+
+                    i++;
+                }
+            }
+
+            Console.WriteLine($"Password is : {sb.ToString()}");
+        }
+    }
+}

+ 8 - 0
D05.1/Properties/launchSettings.json

@@ -0,0 +1,8 @@
+{
+  "profiles": {
+    "D05.1": {
+      "commandName": "Project",
+      "commandLineArgs": "cxdnnyjw"
+    }
+  }
+}

+ 9 - 0
D05.2/D05.2.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <RootNamespace>D05._2</RootNamespace>
+  </PropertyGroup>
+
+</Project>

+ 45 - 0
D05.2/Program.cs

@@ -0,0 +1,45 @@
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace D05._2
+{
+    class Program
+    {
+        static byte[] ToB(string str) => Encoding.ASCII.GetBytes(str);
+        static string ToS(byte[] b) => BitConverter.ToString(b).Replace("-", "");
+
+        static void Main(string[] args)
+        {
+            if (args.Length < 1) throw new ArgumentException();
+            string input = args[0];
+
+            var password = new char[8];
+            int found = 0;
+
+            using (var md5 = MD5.Create())
+            {
+                int i = 0;
+                while (found < 8)
+                {
+                    var h = md5.ComputeHash(ToB($"{input}{i}"));
+                    var sh = ToS(h);
+
+                    if (sh.StartsWith("00000") && sh[5] < '8')
+                    {
+                        int p = sh[5] - '0';
+                        if (password[p] == '\0')
+                        {
+                            found++;
+                            password[p] = sh[6];
+                        }
+                    }
+
+                    i++;
+                }
+            }
+
+            Console.WriteLine($"Password is : {string.Join("", password)}");
+        }
+    }
+}

+ 8 - 0
D05.2/Properties/launchSettings.json

@@ -0,0 +1,8 @@
+{
+  "profiles": {
+    "D05.2": {
+      "commandName": "Project",
+      "commandLineArgs": "cxdnnyjw"
+    }
+  }
+}