Skip to content

Commit

Permalink
Added github actions for publishing and updated to C# 9 (#3)
Browse files Browse the repository at this point in the history
* Upgraded to C# 9 and added github actions

* Added dev version and fixed yaml

* Removed WindowsForms project from release build

* Added publishing

* Changed to only published releases

* Added source to nuget push

* Updated changelog and version
  • Loading branch information
ilya-git committed Nov 27, 2020
1 parent 86ad488 commit cc833a2
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 20 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions SimpleHashing.Net.Tests/SimpleHashTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion SimpleHashing.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions SimpleHashing.Net/SimpleHashParameters.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;

namespace SimpleHashing.Net
{
Expand All @@ -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)
Expand All @@ -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];
}
}
}
11 changes: 6 additions & 5 deletions SimpleHashing.Net/SimpleHashing.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.0.1</Version>
<Version>2.1.0</Version>
<Authors>Ilya Chernomordik</Authors>
<Company></Company>
<Product />
<Description>A simple password hashing based on top of Microsoft PBKDF2 with an easy to use interface</Description>
<PackageReleaseNotes>Added an additional tag to nuget</PackageReleaseNotes>
<PackageTags>pbkdf2, cryptography, Microsoft, hash, hashing, security, encryption, password, Rfc2898DeriveBytes, bcrypt</PackageTags>
<RepositoryUrl></RepositoryUrl>
<RepositoryUrl>https://github.com/ilya-git/SimpleHashing.Net.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/ilya-git/SimpleHashing.Net</PackageProjectUrl>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
<LangVersion>9</LangVersion>
</PropertyGroup>

</Project>

0 comments on commit cc833a2

Please sign in to comment.