2
0

KeyExchangeDiffieHellmanGroupExchangeSha256.cs 1004 B

123456789101112131415161718192021222324252627282930313233
  1. using Renci.SshNet.Security.Cryptography;
  2. namespace Renci.SshNet.Security
  3. {
  4. /// <summary>
  5. /// Represents "diffie-hellman-group-exchange-sha256" algorithm implementation.
  6. /// </summary>
  7. public class KeyExchangeDiffieHellmanGroupExchangeSha256 : KeyExchangeDiffieHellmanGroupExchangeShaBase
  8. {
  9. /// <summary>
  10. /// Gets algorithm name.
  11. /// </summary>
  12. public override string Name
  13. {
  14. get { return "diffie-hellman-group-exchange-sha256"; }
  15. }
  16. /// <summary>
  17. /// Hashes the specified data bytes.
  18. /// </summary>
  19. /// <param name="hashBytes">Data to hash.</param>
  20. /// <returns>
  21. /// Hashed bytes
  22. /// </returns>
  23. protected override byte[] Hash(byte[] hashBytes)
  24. {
  25. using (var sha256 = HashAlgorithmFactory.CreateSHA256())
  26. {
  27. return sha256.ComputeHash(hashBytes);
  28. }
  29. }
  30. }
  31. }