diff --git a/LICENSE.txt b/LICENSE.txt index 46bfdcb4..4be89ce9 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -624,6 +624,7 @@ copy of the Program in return for a fee. END OF TERMS AND CONDITIONS Copyright (C) 2015 clowwindy +Copyright (C) 2020 Shadowsocks Project This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/shadowsocks-csharp/Controller/Service/PACServer.cs b/shadowsocks-csharp/Controller/Service/PACServer.cs index 7833e01a..57e64ca2 100644 --- a/shadowsocks-csharp/Controller/Service/PACServer.cs +++ b/shadowsocks-csharp/Controller/Service/PACServer.cs @@ -1,15 +1,10 @@ -using System; -using System.Collections; -using System.Globalization; -using System.IO; +using Shadowsocks.Encryption; +using Shadowsocks.Model; +using Shadowsocks.Util; +using System; using System.Net; using System.Net.Sockets; using System.Text; -using Shadowsocks.Encryption; -using Shadowsocks.Model; -using Shadowsocks.Properties; -using Shadowsocks.Util; -using System.Threading.Tasks; using System.Web; namespace Shadowsocks.Controller @@ -53,12 +48,7 @@ namespace Shadowsocks.Controller private static string GetHash(string content) { - var contentBytes = Encoding.ASCII.GetBytes(content); - using (var md5 = System.Security.Cryptography.MD5.Create()) - { - var md5Bytes = md5.ComputeHash(contentBytes); - return HttpServerUtility.UrlTokenEncode(md5Bytes); - }; + return HttpServerUtility.UrlTokenEncode(MbedTLS.MD5(Encoding.ASCII.GetBytes(content))); } public override bool Handle(byte[] firstPacket, int length, Socket socket, object state) diff --git a/shadowsocks-csharp/Encryption/EncryptorFactory.cs b/shadowsocks-csharp/Encryption/EncryptorFactory.cs index 169a67ce..fcae221a 100644 --- a/shadowsocks-csharp/Encryption/EncryptorFactory.cs +++ b/shadowsocks-csharp/Encryption/EncryptorFactory.cs @@ -70,7 +70,7 @@ namespace Shadowsocks.Encryption { if (method.IsNullOrEmpty()) { - method = "aes-256-cfb"; + method = Model.Server.DefaultMethod; } method = method.ToLowerInvariant(); diff --git a/shadowsocks-csharp/Model/Server.cs b/shadowsocks-csharp/Model/Server.cs index 88f72c2c..6e08f50e 100755 --- a/shadowsocks-csharp/Model/Server.cs +++ b/shadowsocks-csharp/Model/Server.cs @@ -11,6 +11,9 @@ namespace Shadowsocks.Model [Serializable] public class Server { + public const string DefaultMethod = "chacha20-ietf-poly1305"; + public const int DefaultPort = 8388; + #region ParseLegacyURL public static readonly Regex UrlFinder = new Regex(@"ss://(?[A-Za-z0-9+-/=_]+)(?:#(?\S+))?", RegexOptions.IgnoreCase), @@ -69,8 +72,8 @@ namespace Shadowsocks.Model public Server() { server = ""; - server_port = 8388; - method = "chacha20-ietf-poly1305"; + server_port = DefaultPort; + method = DefaultMethod; plugin = ""; plugin_opts = ""; plugin_args = ""; diff --git a/shadowsocks-csharp/Properties/AssemblyInfo.cs b/shadowsocks-csharp/Properties/AssemblyInfo.cs index bbb3a28a..b140accf 100755 --- a/shadowsocks-csharp/Properties/AssemblyInfo.cs +++ b/shadowsocks-csharp/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Shadowsocks")] -[assembly: AssemblyCopyright("clowwindy & community 2019")] +[assembly: AssemblyCopyright("clowwindy & community 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 8151dc58..379edc29 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -316,7 +316,7 @@ namespace Shadowsocks.View IPTextBox.Text = server.server; ServerPortTextBox.Text = server.server_port.ToString(); PasswordTextBox.Text = server.password; - EncryptionSelect.Text = server.method ?? "aes-256-cfb"; + EncryptionSelect.Text = server.method ?? Server.DefaultMethod; PluginTextBox.Text = server.plugin; PluginOptionsTextBox.Text = server.plugin_opts; PluginArgumentsTextBox.Text = server.plugin_args;