diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 0000000..0bed5c6 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,9 @@ +name: build-and-test +on: [push, pull_request] +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: dotnet build -c Release + - run: dotnet test -c Release --no-build \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..4f058f6 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,14 @@ +name: publish +on: + release: + types: [published] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: dotnet build -c Release + - run: dotnet test -c Release --no-build + - run: dotnet nuget push "**/*.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b06e864..6d4aebe 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ bld/ # Visual Studio 2015 cache/options directory .vs/ +# Rider +.idea/ + # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aeb8f3..d663d9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ -Version 2.0 +Version 2.1 (2020-11-27) + + - Added nullable context and updated to C# 9 + +Version 2.0 (2020-01-15) - Framework Changed to NetStandard 2.0 diff --git a/SimpleHashing.Net.Tests/SimpleHashTests.cs b/SimpleHashing.Net.Tests/SimpleHashTests.cs index 15b2235..702babe 100644 --- a/SimpleHashing.Net.Tests/SimpleHashTests.cs +++ b/SimpleHashing.Net.Tests/SimpleHashTests.cs @@ -20,9 +20,8 @@ public void TestInitialize() [TestMethod] public void Estimate_Always_ReturnsReasonableTime() { - TimeSpan estimate = m_SimpleHash.Estimate(TestPassword, 50); - - Assert.IsTrue(estimate.TotalMilliseconds < 10); + var estimate = m_SimpleHash.Estimate(TestPassword, 50); + Assert.IsTrue(estimate.TotalMilliseconds < 50); } [TestMethod, ExpectedException(typeof (ArgumentException))] @@ -64,7 +63,7 @@ public void Verify_WithWrongPassword_ReturnsFalse() } [TestMethod] - public void Verfiy_WithoutIterationsParameter_WorksWithDefault() + public void Verify_WithoutIterationsParameter_WorksWithDefault() { string hash = m_SimpleHash.Compute(TestPassword); diff --git a/SimpleHashing.Net.sln b/SimpleHashing.Net.sln index 6ce7023..c14bfe4 100644 --- a/SimpleHashing.Net.sln +++ b/SimpleHashing.Net.sln @@ -18,7 +18,6 @@ Global {90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Debug|Any CPU.Build.0 = Debug|Any CPU {90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Release|Any CPU.Build.0 = Release|Any CPU {7E8A0E0B-CDD1-4A7B-957F-EC57D5CFB5CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7E8A0E0B-CDD1-4A7B-957F-EC57D5CFB5CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E8A0E0B-CDD1-4A7B-957F-EC57D5CFB5CF}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/SimpleHashing.Net/SimpleHashParameters.cs b/SimpleHashing.Net/SimpleHashParameters.cs index efd8295..f13fc04 100644 --- a/SimpleHashing.Net/SimpleHashParameters.cs +++ b/SimpleHashing.Net/SimpleHashParameters.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace SimpleHashing.Net { @@ -16,7 +17,10 @@ public SimpleHashParameters(string passwordHashString) { string[] parameters = ParseParameters(passwordHashString); - ProcessParameters(parameters); + Algorithm = parameters[0]; + Iterations = int.Parse(parameters[1]); + Salt = parameters[2]; + PasswordHash = parameters[3]; } private static string[] ParseParameters(string passwordHashString) @@ -29,13 +33,5 @@ private static string[] ParseParameters(string passwordHashString) } return parameters; } - - private void ProcessParameters(string[] parameters) - { - Algorithm = parameters[0]; - Iterations = int.Parse(parameters[1]); - Salt = parameters[2]; - PasswordHash = parameters[3]; - } } } \ No newline at end of file diff --git a/SimpleHashing.Net/SimpleHashing.Net.csproj b/SimpleHashing.Net/SimpleHashing.Net.csproj index d85ee0b..f4ba979 100644 --- a/SimpleHashing.Net/SimpleHashing.Net.csproj +++ b/SimpleHashing.Net/SimpleHashing.Net.csproj @@ -3,15 +3,16 @@ netstandard2.0 true - 2.0.1 + 2.1.0 Ilya Chernomordik - - A simple password hashing based on top of Microsoft PBKDF2 with an easy to use interface Added an additional tag to nuget pbkdf2, cryptography, Microsoft, hash, hashing, security, encryption, password, Rfc2898DeriveBytes, bcrypt - + https://github.com/ilya-git/SimpleHashing.Net.git https://github.com/ilya-git/SimpleHashing.Net + enable + nullable + 9 - +