mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
86dc811458
* Drop net6.0 target
* Update src/Renci.SshNet/Common/TaskToAsyncResult.cs
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
* remove redundant #if
for some reason this made the compiler suddenly
realize that the plain text variables are unused.
* use TargetFrameworkIdentifier
this doesn't work in Directory.Build.props, moved it to Directory.Build.targets.
* fix null reference warnings in Benchmarks
seems like the warnings were (somehow) disabled here
before and were fixed by the previous TargetFrameworkIdentifier
change.
* fix unused plainTextOffset in AesGcmCipher.BclImpl
* CI retry
* more cosmetics
* more
* update README
* Revert "use TargetFrameworkIdentifier"
This reverts commit 076ede161d.
---------
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using BenchmarkDotNet.Attributes;
|
|
|
|
using Renci.SshNet.Security;
|
|
using Renci.SshNet.Security.Cryptography;
|
|
|
|
namespace Renci.SshNet.Benchmarks.Security.Cryptography
|
|
{
|
|
[MemoryDiagnoser]
|
|
public class ED25519DigitalSignatureBenchmarks
|
|
{
|
|
private readonly ED25519Key _key;
|
|
private readonly byte[] _data;
|
|
private readonly byte[] _signature;
|
|
|
|
public ED25519DigitalSignatureBenchmarks()
|
|
{
|
|
_data = new byte[128];
|
|
|
|
Random random = new(Seed: 12345);
|
|
random.NextBytes(_data);
|
|
|
|
using (var s = typeof(ED25519DigitalSignatureBenchmarks).Assembly.GetManifestResourceStream("Renci.SshNet.Benchmarks.Data.Key.OPENSSH.ED25519.txt"))
|
|
{
|
|
_key = (ED25519Key)new PrivateKeyFile(s!).Key;
|
|
}
|
|
_signature = new ED25519DigitalSignature(_key).Sign(_data);
|
|
}
|
|
|
|
[Benchmark]
|
|
public byte[] Sign()
|
|
{
|
|
return new ED25519DigitalSignature(_key).Sign(_data);
|
|
}
|
|
|
|
[Benchmark]
|
|
public bool Verify()
|
|
{
|
|
return new ED25519DigitalSignature(_key).Verify(_data, _signature);
|
|
}
|
|
}
|
|
}
|