< Summary

Information
Class: Renci.SshNet.Security.Cryptography.HMACSHA384
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\Cryptography\HMACSHA384.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 60
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%10%
.ctor(...)100%10%
get_HashSize()100%10%
HashFinal()100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\Cryptography\HMACSHA384.cs

#LineLine coverage
 1using System.Security.Cryptography;
 2using Renci.SshNet.Common;
 3
 4namespace Renci.SshNet.Security.Cryptography
 5{
 6    /// <summary>
 7    /// Computes a Hash-based Message Authentication Code (HMAC) by using the <see cref="SHA384"/> hash function.
 8    /// </summary>
 9    public class HMACSHA384 : System.Security.Cryptography.HMACSHA384
 10    {
 11        private readonly int _hashSize;
 12
 13        /// <summary>
 14        /// Initializes a new instance of the <see cref="HMACSHA384"/> class with the specified key.
 15        /// </summary>
 16        /// <param name="key">The key.</param>
 17        public HMACSHA384(byte[] key)
 018            : base(key)
 019        {
 20#pragma warning disable MA0056 // Do not call overridable members in constructor
 021            _hashSize = base.HashSize;
 22#pragma warning restore MA0056 // Do not call overridable members in constructor
 023        }
 24
 25        /// <summary>
 26        /// Initializes a new instance of the <see cref="HMACSHA384"/> class with the specified key
 27        /// and size of the computed hash code.
 28        /// </summary>
 29        /// <param name="key">The key.</param>
 30        /// <param name="hashSize">The size, in bits, of the computed hash code.</param>
 31        public HMACSHA384(byte[] key, int hashSize)
 032            : base(key)
 033        {
 034            _hashSize = hashSize;
 035        }
 36
 37        /// <summary>
 38        /// Gets the size, in bits, of the computed hash code.
 39        /// </summary>
 40        /// <value>
 41        /// The size, in bits, of the computed hash code.
 42        /// </value>
 43        public override int HashSize
 44        {
 045            get { return _hashSize; }
 46        }
 47
 48        /// <summary>
 49        /// Finalizes the hash computation after the last data is processed by the cryptographic stream object.
 50        /// </summary>
 51        /// <returns>
 52        /// The computed hash code.
 53        /// </returns>
 54        protected override byte[] HashFinal()
 055        {
 056            var hash = base.HashFinal();
 057            return hash.Take(HashSize / 8);
 058        }
 59    }
 60}