KeyExchangeDiffieHellmanGroupExchangeSha1.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Renci.SshNet.Abstractions;
  2. namespace Renci.SshNet.Security
  3. {
  4. /// <summary>
  5. /// Represents "diffie-hellman-group-exchange-sha1" algorithm implementation.
  6. /// </summary>
  7. internal sealed class KeyExchangeDiffieHellmanGroupExchangeSha1 : KeyExchangeDiffieHellmanGroupExchangeShaBase
  8. {
  9. /// <summary>
  10. /// Gets algorithm name.
  11. /// </summary>
  12. public override string Name
  13. {
  14. get { return "diffie-hellman-group-exchange-sha1"; }
  15. }
  16. /// <summary>
  17. /// Gets the size, in bits, of the computed hash code.
  18. /// </summary>
  19. /// <value>
  20. /// The size, in bits, of the computed hash code.
  21. /// </value>
  22. protected override int HashSize
  23. {
  24. get { return 160; }
  25. }
  26. /// <summary>
  27. /// Hashes the specified data bytes.
  28. /// </summary>
  29. /// <param name="hashData">The hash data.</param>
  30. /// <returns>
  31. /// The hash of the data.
  32. /// </returns>
  33. protected override byte[] Hash(byte[] hashData)
  34. {
  35. using (var sha1 = CryptoAbstraction.CreateSHA1())
  36. {
  37. return sha1.ComputeHash(hashData, 0, hashData.Length);
  38. }
  39. }
  40. }
  41. }