@@ -624,6 +624,7 @@ copy of the Program in return for a fee. | |||||
END OF TERMS AND CONDITIONS | END OF TERMS AND CONDITIONS | ||||
Copyright (C) 2015 clowwindy <clowwindy42@gmail.com> | Copyright (C) 2015 clowwindy <clowwindy42@gmail.com> | ||||
Copyright (C) 2020 Shadowsocks Project <https://shadowsocks.org> | |||||
This program is free software: you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -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; | ||||
using System.Net.Sockets; | using System.Net.Sockets; | ||||
using System.Text; | using System.Text; | ||||
using Shadowsocks.Encryption; | |||||
using Shadowsocks.Model; | |||||
using Shadowsocks.Properties; | |||||
using Shadowsocks.Util; | |||||
using System.Threading.Tasks; | |||||
using System.Web; | using System.Web; | ||||
namespace Shadowsocks.Controller | namespace Shadowsocks.Controller | ||||
@@ -53,12 +48,7 @@ namespace Shadowsocks.Controller | |||||
private static string GetHash(string content) | 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) | public override bool Handle(byte[] firstPacket, int length, Socket socket, object state) | ||||
@@ -70,7 +70,7 @@ namespace Shadowsocks.Encryption | |||||
{ | { | ||||
if (method.IsNullOrEmpty()) | if (method.IsNullOrEmpty()) | ||||
{ | { | ||||
method = "aes-256-cfb"; | |||||
method = Model.Server.DefaultMethod; | |||||
} | } | ||||
method = method.ToLowerInvariant(); | method = method.ToLowerInvariant(); | ||||
@@ -11,6 +11,9 @@ namespace Shadowsocks.Model | |||||
[Serializable] | [Serializable] | ||||
public class Server | public class Server | ||||
{ | { | ||||
public const string DefaultMethod = "chacha20-ietf-poly1305"; | |||||
public const int DefaultPort = 8388; | |||||
#region ParseLegacyURL | #region ParseLegacyURL | ||||
public static readonly Regex | public static readonly Regex | ||||
UrlFinder = new Regex(@"ss://(?<base64>[A-Za-z0-9+-/=_]+)(?:#(?<tag>\S+))?", RegexOptions.IgnoreCase), | UrlFinder = new Regex(@"ss://(?<base64>[A-Za-z0-9+-/=_]+)(?:#(?<tag>\S+))?", RegexOptions.IgnoreCase), | ||||
@@ -69,8 +72,8 @@ namespace Shadowsocks.Model | |||||
public Server() | public Server() | ||||
{ | { | ||||
server = ""; | server = ""; | ||||
server_port = 8388; | |||||
method = "chacha20-ietf-poly1305"; | |||||
server_port = DefaultPort; | |||||
method = DefaultMethod; | |||||
plugin = ""; | plugin = ""; | ||||
plugin_opts = ""; | plugin_opts = ""; | ||||
plugin_args = ""; | plugin_args = ""; | ||||
@@ -11,7 +11,7 @@ using System.Runtime.InteropServices; | |||||
[assembly: AssemblyConfiguration("")] | [assembly: AssemblyConfiguration("")] | ||||
[assembly: AssemblyCompany("")] | [assembly: AssemblyCompany("")] | ||||
[assembly: AssemblyProduct("Shadowsocks")] | [assembly: AssemblyProduct("Shadowsocks")] | ||||
[assembly: AssemblyCopyright("clowwindy & community 2019")] | |||||
[assembly: AssemblyCopyright("clowwindy & community 2020")] | |||||
[assembly: AssemblyTrademark("")] | [assembly: AssemblyTrademark("")] | ||||
[assembly: AssemblyCulture("")] | [assembly: AssemblyCulture("")] | ||||
@@ -316,7 +316,7 @@ namespace Shadowsocks.View | |||||
IPTextBox.Text = server.server; | IPTextBox.Text = server.server; | ||||
ServerPortTextBox.Text = server.server_port.ToString(); | ServerPortTextBox.Text = server.server_port.ToString(); | ||||
PasswordTextBox.Text = server.password; | PasswordTextBox.Text = server.password; | ||||
EncryptionSelect.Text = server.method ?? "aes-256-cfb"; | |||||
EncryptionSelect.Text = server.method ?? Server.DefaultMethod; | |||||
PluginTextBox.Text = server.plugin; | PluginTextBox.Text = server.plugin; | ||||
PluginOptionsTextBox.Text = server.plugin_opts; | PluginOptionsTextBox.Text = server.plugin_opts; | ||||
PluginArgumentsTextBox.Text = server.plugin_args; | PluginArgumentsTextBox.Text = server.plugin_args; | ||||