diff --git a/MarketData.csproj b/MarketData.csproj index c903eab..1e65f1c 100644 --- a/MarketData.csproj +++ b/MarketData.csproj @@ -1,4 +1,4 @@ - + Debug diff --git a/Program.cs b/Program.cs index 80b4e2d..7453316 100644 --- a/Program.cs +++ b/Program.cs @@ -26,9 +26,48 @@ using MarketData.CNNProcessing; using MySql.Data.MySqlClient; using MarketData.Generator.MovingAverage; using MarketData.Generator.MGSHMomentum; +using System.Security.Cryptography; namespace MarketData { + //public static class Security + //{ + // public static string HashPassword(string password) + // { + // using (SHA256 sha256 = SHA256.Create()) + // { + // byte[] bytes = Encoding.UTF8.GetBytes(password); + // byte[] hashBytes = sha256.ComputeHash(bytes); + // return Convert.ToBase64String(hashBytes); + // } + // } + + // public static (string Salt, string Hash) HashPasswordWithSalt(string password) + // { + // using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()) + // { + // byte[] salt = new byte[16]; + // rng.GetBytes(salt); + // using (SHA256 sha256 = SHA256.Create()) + // { + // byte[] passwordBytes = Encoding.UTF8.GetBytes(password); + // byte[] saltedPassword = new byte[passwordBytes.Length + salt.Length]; + // Buffer.BlockCopy(passwordBytes, 0, saltedPassword, 0, passwordBytes.Length); + // Buffer.BlockCopy(salt, 0, saltedPassword, passwordBytes.Length, salt.Length); + // byte[] hashBytes = sha256.ComputeHash(saltedPassword); + // return (Convert.ToBase64String(salt), Convert.ToBase64String(hashBytes)); + // } + // } + // } + + + + + + //} + + + class Program { public static void DisplayUsage()