Skip to content

Commit 0dbd8a0

Browse files
committed
Only .NET 8 release from now on
Drop support for .NET Standard and .NET 6
1 parent f3dbfe1 commit 0dbd8a0

7 files changed

+18
-21
lines changed

CHANGE-LOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version 1.1.0 (released 2024-12-06)
2+
- Drop support for .NET Standard and .NET 6 (**BREAKING**)
3+
- SIMD support for XOR operation (**PERFORMANCE**)
4+
15
## Version 1.0.1 (released 2023-11-16)
26
- Include nuget-readme
37
- Support net8.0

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CSharp-ChaCha20-NetStandard
22

3-
Managed .Net (Standard 2.0, .NET 6 and .NET 8) compatible [ChaCha20](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant) cipher written in C#
3+
Managed .Net (.NET 8) compatible [ChaCha20](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant) cipher written in C#
44

55
## Build status
66
![.NET](https://github.com/mcraiha/CSharp-ChaCha20-NetStandard/workflows/.NET/badge.svg)
@@ -14,6 +14,10 @@ Because I needed this for my personal project
1414

1515
**Scott Bennett** wrote C# implementation called [ChaCha20-csharp](https://github.com/sbennett1990/ChaCha20-csharp), which works as base for my code. That is why the license is same for both projects
1616

17+
## Older versions
18+
19+
YOu can find OLD .NET Standard and .NET 6 compatible version from [older branch](https://github.com/mcraiha/CSharp-ChaCha20-NetStandard/tree/netstandard20andnet6)
20+
1721
## Documentation
1822

1923
[Docs](https://mcraiha.github.io/CSharp-ChaCha20-NetStandard/api/index.html)

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CSharp-ChaCha20-NetStandard
2-
Managed .Net Standard 2.0 compatible [ChaCha20](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant) cipher written in C#
2+
Managed .Net (.NET 8) compatible [ChaCha20](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant) cipher written in C#
33

44
## GitHub
55
[CSharp-ChaCha20-NetStandard](https://github.com/mcraiha/CSharp-ChaCha20-NetStandard)

nuget-readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CSharp-ChaCha20-NetStandard
22

3-
Managed .Net (Standard 2.0, .NET 6 and .NET 8) compatible [ChaCha20](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant) cipher written in C#
3+
Managed .Net (.NET 8) compatible [ChaCha20](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant) cipher written in C#
44

55
## Documentation
66

src/CSChaCha20.cs

+1-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
using System;
1919
using System.IO;
20-
using System.Text;
2120
using System.Threading.Tasks;
2221
using System.Runtime.Intrinsics;
2322
using System.Runtime.CompilerServices; // For MethodImplOptions.AggressiveInlining
@@ -108,8 +107,6 @@ public ChaCha20(byte[] key, byte[] nonce, uint counter)
108107
this.IvSetup(nonce, counter);
109108
}
110109

111-
#if NET6_0_OR_GREATER
112-
113110
/// <summary>
114111
/// Set up a new ChaCha20 state. The lengths of the given parameters are checked before encryption happens.
115112
/// </summary>
@@ -118,15 +115,13 @@ public ChaCha20(byte[] key, byte[] nonce, uint counter)
118115
/// </remarks>
119116
/// <param name="key">A 32-byte (256-bit) key, treated as a concatenation of eight 32-bit little-endian integers</param>
120117
/// <param name="nonce">A 12-byte (96-bit) nonce, treated as a concatenation of three 32-bit little-endian integers</param>
121-
/// <param name="counter">A 4-byte (32-bit) block counter, treated as a 32-bit little-endian integer</param>
118+
/// <param name="counter">A 4-byte (32-bit) block counter, treated as a 32-bit little-endian unsigned integer</param>
122119
public ChaCha20(ReadOnlySpan<byte> key, ReadOnlySpan<byte> nonce, uint counter)
123120
{
124121
this.KeySetup(key.ToArray());
125122
this.IvSetup(nonce.ToArray(), counter);
126123
}
127124

128-
#endif // NET6_0_OR_GREATER
129-
130125
/// <summary>
131126
/// The ChaCha20 state (aka "context"). Read-Only.
132127
/// </summary>
@@ -141,13 +136,8 @@ public uint[] State
141136

142137
// These are the same constants defined in the reference implementation.
143138
// http://cr.yp.to/streamciphers/timings/estreambench/submissions/salsa20/chacha8/ref/chacha.c
144-
#if NET8_0_OR_GREATER
145139
private static readonly byte[] sigma = "expand 32-byte k"u8.ToArray();
146140
private static readonly byte[] tau = "expand 16-byte k"u8.ToArray();
147-
#else
148-
private static readonly byte[] sigma = Encoding.ASCII.GetBytes("expand 32-byte k");
149-
private static readonly byte[] tau = Encoding.ASCII.GetBytes("expand 16-byte k");
150-
#endif // NET8_0_OR_GREATER
151141

152142
/// <summary>
153143
/// Set up the ChaCha state with the given key. A 32-byte key is required and enforced.

src/ChaCha20-NetStandard.csproj

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<PropertyGroup>
44
<TargetFrameworks>net8.0</TargetFrameworks>
55
<PackageId>LibChaCha20</PackageId>
6-
<VersionPrefix>1.0.1</VersionPrefix>
6+
<VersionPrefix>1.1.0</VersionPrefix>
77
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
88
<Authors>Kaarlo Räihä</Authors>
9-
<Description>Managed C# .NET (Standard 2.0, .NET 6 and .NET 8) library for ChaCha20 encrypting and decrypting</Description>
9+
<Description>Managed C# .NET (.NET 8) library for ChaCha20 encrypting and decrypting</Description>
1010
<IncludeSource>true</IncludeSource>
1111
<PackageProjectUrl>https://github.com/mcraiha/CSharp-ChaCha20-NetStandard</PackageProjectUrl>
1212
<RepositoryUrl>https://github.com/mcraiha/CSharp-ChaCha20-NetStandard.git</RepositoryUrl>
@@ -23,7 +23,10 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
26+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
27+
<PrivateAssets>all</PrivateAssets>
28+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
29+
</PackageReference>
2730
</ItemGroup>
2831

2932
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">

tests/ChaCha20Tests.cs

-4
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,6 @@ public void StateReadPossibleTest()
564564
Assert.AreEqual(16, forEncrypting1.State.Length, "Valid state lenght should always be 16 bytes");
565565
}
566566

567-
#if NET6_0_OR_GREATER
568-
569567
[Test, Description("Check that ReadOnlySpan constructor works as it should")]
570568
public void ReadOnlySpanConstructorTest()
571569
{
@@ -590,7 +588,5 @@ public void ReadOnlySpanConstructorTest()
590588
CollectionAssert.AreEqual(cRegular1.State, cRreadOnlySpan1.State);
591589
CollectionAssert.AreEqual(cRegular2.State, cRreadOnlySpan2.State);
592590
}
593-
594-
#endif // NET6_0_OR_GREATER
595591
}
596592
}

0 commit comments

Comments
 (0)