sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
MIT License
3.87k stars 915 forks source link

Use System.Security.Cryptography for RSA #1373

Closed Rob-Hague closed 1 month ago

Rob-Hague commented 2 months ago

And remove the hand-rolled implementation

Before:

Method Mean Error StdDev Gen0 Allocated
Sign 7,399.7 μs 20.87 μs 18.50 μs 2890.6250 5915.73 KB
Verify 132.8 μs 0.16 μs 0.14 μs 22.2168 45.74 KB

After:

Method Mean Error StdDev Gen0 Allocated
Sign 480.00 μs 0.794 μs 0.663 μs - 369 B
Verify 15.05 μs 0.017 μs 0.016 μs 0.1678 368 B

closes #1388

Rob-Hague commented 2 months ago

After this, I will do something similar for DSA, and then switch BigInteger over to the BCL

scott-xu commented 2 months ago

One other thing: we can refer System.Memory nuget package when target to net462 and netstandard2.0 so that the code can use Span<T> ReadOnlySpan<T> BinaryPrimitives etc.

Rob-Hague commented 2 months ago

Yes, it is on my slow-moving todo list, perhaps starting with reviving #1160. Feel free to get it started, I probably won't work on it in the immediate future