Skip to content

Commit cc833a2

Browse files
authored
Added github actions for publishing and updated to C# 9 (#3)
* 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
1 parent 86ad488 commit cc833a2

File tree

8 files changed

+45
-20
lines changed

8 files changed

+45
-20
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: build-and-test
2+
on: [push, pull_request]
3+
jobs:
4+
build-and-test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- run: dotnet build -c Release
9+
- run: dotnet test -c Release --no-build

.github/workflows/publish.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: publish
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- run: dotnet build -c Release
11+
- run: dotnet test -c Release --no-build
12+
- run: dotnet nuget push "**/*.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
13+
env:
14+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ bld/
2525
# Visual Studio 2015 cache/options directory
2626
.vs/
2727

28+
# Rider
29+
.idea/
30+
2831
# MSTest test Results
2932
[Tt]est[Rr]esult*/
3033
[Bb]uild[Ll]og.*

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
Version 2.0
1+
Version 2.1 (2020-11-27)
2+
3+
- Added nullable context and updated to C# 9
4+
5+
Version 2.0 (2020-01-15)
26

37
- Framework Changed to NetStandard 2.0

SimpleHashing.Net.Tests/SimpleHashTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ public void TestInitialize()
2020
[TestMethod]
2121
public void Estimate_Always_ReturnsReasonableTime()
2222
{
23-
TimeSpan estimate = m_SimpleHash.Estimate(TestPassword, 50);
24-
25-
Assert.IsTrue(estimate.TotalMilliseconds < 10);
23+
var estimate = m_SimpleHash.Estimate(TestPassword, 50);
24+
Assert.IsTrue(estimate.TotalMilliseconds < 50);
2625
}
2726

2827
[TestMethod, ExpectedException(typeof (ArgumentException))]
@@ -64,7 +63,7 @@ public void Verify_WithWrongPassword_ReturnsFalse()
6463
}
6564

6665
[TestMethod]
67-
public void Verfiy_WithoutIterationsParameter_WorksWithDefault()
66+
public void Verify_WithoutIterationsParameter_WorksWithDefault()
6867
{
6968
string hash = m_SimpleHash.Compute(TestPassword);
7069

SimpleHashing.Net.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Global
1818
{90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1919
{90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Debug|Any CPU.Build.0 = Debug|Any CPU
2020
{90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Release|Any CPU.ActiveCfg = Release|Any CPU
21-
{90F7B3F6-6B70-49B1-97C9-6C12F445144D}.Release|Any CPU.Build.0 = Release|Any CPU
2221
{7E8A0E0B-CDD1-4A7B-957F-EC57D5CFB5CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2322
{7E8A0E0B-CDD1-4A7B-957F-EC57D5CFB5CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
2423
{7E8A0E0B-CDD1-4A7B-957F-EC57D5CFB5CF}.Release|Any CPU.ActiveCfg = Release|Any CPU

SimpleHashing.Net/SimpleHashParameters.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23

34
namespace SimpleHashing.Net
45
{
@@ -16,7 +17,10 @@ public SimpleHashParameters(string passwordHashString)
1617
{
1718
string[] parameters = ParseParameters(passwordHashString);
1819

19-
ProcessParameters(parameters);
20+
Algorithm = parameters[0];
21+
Iterations = int.Parse(parameters[1]);
22+
Salt = parameters[2];
23+
PasswordHash = parameters[3];
2024
}
2125

2226
private static string[] ParseParameters(string passwordHashString)
@@ -29,13 +33,5 @@ private static string[] ParseParameters(string passwordHashString)
2933
}
3034
return parameters;
3135
}
32-
33-
private void ProcessParameters(string[] parameters)
34-
{
35-
Algorithm = parameters[0];
36-
Iterations = int.Parse(parameters[1]);
37-
Salt = parameters[2];
38-
PasswordHash = parameters[3];
39-
}
4036
}
4137
}

SimpleHashing.Net/SimpleHashing.Net.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6-
<Version>2.0.1</Version>
6+
<Version>2.1.0</Version>
77
<Authors>Ilya Chernomordik</Authors>
8-
<Company></Company>
9-
<Product />
108
<Description>A simple password hashing based on top of Microsoft PBKDF2 with an easy to use interface</Description>
119
<PackageReleaseNotes>Added an additional tag to nuget</PackageReleaseNotes>
1210
<PackageTags>pbkdf2, cryptography, Microsoft, hash, hashing, security, encryption, password, Rfc2898DeriveBytes, bcrypt</PackageTags>
13-
<RepositoryUrl></RepositoryUrl>
11+
<RepositoryUrl>https://github.com/ilya-git/SimpleHashing.Net.git</RepositoryUrl>
1412
<PackageProjectUrl>https://github.com/ilya-git/SimpleHashing.Net</PackageProjectUrl>
13+
<Nullable>enable</Nullable>
14+
<WarningsAsErrors>nullable</WarningsAsErrors>
15+
<LangVersion>9</LangVersion>
1516
</PropertyGroup>
16-
17+
1718
</Project>

0 commit comments

Comments
 (0)