Refactor deployment script and replace RNGCryptoServiceProvider
Some checks failed
Build .NET Project / build (push) Has been cancelled

This commit is contained in:
2026-03-13 18:04:52 -04:00
parent b87dea3473
commit e2331010f1
4 changed files with 68 additions and 17 deletions

View File

@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axiom.Core", "Axiom.Core.csproj", "{379CF069-D825-5068-77C8-E340F5D2FC2D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7DE04B9E-BE44-48A3-9B4D-C40BA39CC963}
EndGlobalSection
EndGlobal

View File

@@ -16,21 +16,36 @@ namespace MarketData.Security
}
}
// 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));
// }
// }
// }
public static (string Salt, string Hash) HashPasswordWithSalt(string password)
{
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
byte[] salt = new byte[16];
RandomNumberGenerator.Fill(salt);
using (SHA256 sha256 = SHA256.Create())
{
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));
}
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));
}
}

View File

@@ -234,3 +234,11 @@ Also note that 1>/dev/null is synonymous to, but more explicit than >/dev/null
# Financial
1) Economic Indicators - https://docs.tradingeconomics.com/
# DOTNET related notes
Slow builds and C# Dev Kit Errors
ps -u $USER -o pid,cmd | grep -E 'csdevkit|visualstudio-projectsystem-buildhost|vstest.console' | grep dotnet | awk '#{print $1}' | xargs -r kill -9 || true
This shows where dotnet performance is
dotnet build /clp:PerformanceSummary

View File

@@ -11,8 +11,10 @@
# set xtrace if you want to see trace level
#set -o xtrace
sudo service cron stop
sudo service cron status
# use systemctl so we can bypass the pager
sudo systemctl --no-pager stop cron
sudo systemctl --no-pager status cron
# The name of the MK process that we will need to ensure is not running during the deployment
PROCESS_NAME="mk"
@@ -74,7 +76,8 @@ done
# Check if source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
echo "Error: Source directory '$SOURCE_DIR' not found."
sudo service cron restart
# use systemctl so we can bypass the pager prompts
sudo systemctl --no-pager restart cron
exit 1
fi
@@ -122,8 +125,9 @@ echo ""
echo "Files copied from '$SOURCE_DIR' to '$DEST_DIR'."
sudo service cron restart
sudo service cron status
# use systemctl so we can bypass the pager prompts
sudo systemctl --no-pager restart cron
sudo systemctl --no-pager status cron
echo "Done."