secure-remote-password / srp.net

SRP-6a protocol implementation for .NET Standard 1.6+ and .NET Framework 3.5+
https://www.nuget.org/packages/srp
MIT License
64 stars 10 forks source link

Allow a custom salt length in `GenerateSalt()`. #18

Closed mrhappyasthma closed 2 years ago

mrhappyasthma commented 2 years ago

I'm working with an SRP implementation that uses a custom salt length that differs from HashSizeBytes. Other SRP implementations (e.g. python) allow this. (source: https://github.com/cocagne/pysrp/blob/master/srp/_pysrp.py#L224).

This value is optional, so if unset it will just fallback to Parameters.HashSizeBytes as the default.

I worked around this locally by calling directly in to SrpInteger.RandomInteger() in my code, but it reads much better to be able to do something like:

client.GenerateSalt(saltLength: 256)
mrhappyasthma commented 2 years ago

Forgot to also update the interface. (sorry still getting a handle on C#). I believe it should compile correctly now.

yallie commented 2 years ago

Thank you! 👍