using System.Security.Cryptography; using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography { /// /// Computes a Hash-based Message Authentication Code (HMAC) by using the hash function. /// public class HMACMD5 : System.Security.Cryptography.HMACMD5 { private readonly int _hashSize; /// /// Initializes a with the specified key. /// /// The key. public HMACMD5(byte[] key) : base(key) { _hashSize = base.HashSize; } /// /// Initializes a with the specified key and size of the computed hash code. /// /// The key. /// The size, in bits, of the computed hash code. public HMACMD5(byte[] key, int hashSize) : base(key) { _hashSize = hashSize; } /// /// Gets the size, in bits, of the computed hash code. /// /// /// The size, in bits, of the computed hash code. /// public override int HashSize { get { return _hashSize; } } /// /// Finalizes the hash computation after the last data is processed by the cryptographic stream object. /// /// /// The computed hash code. /// protected override byte[] HashFinal() { var hash = base.HashFinal(); return hash.Take(HashSize / 8); } } }