using System;
using System.Security.Cryptography;
using Renci.SshNet.Common;
namespace Renci.SshNet
{
///
/// Holds information about key size and cipher to use.
///
public class HashInfo
{
///
/// Gets the size of the key.
///
///
/// The size of the key.
///
public int KeySize { get; private set; }
///
/// Gets a value indicating whether the MAC algorithm will use encrypt-then-MAC ordering.
///
///
/// to enable encrypt-then-MAC, to use encrypt-and-MAC.
///
public bool IsEncryptThenMAC { get; private set; }
///
/// Gets the method for creating a instance
/// given a key.
///
public Func HashAlgorithm { get; private set; }
///
/// Initializes a new instance of the class.
///
/// Size of the key.
/// The hash algorithm to use for a given key.
/// to enable encrypt-then-MAC, to use encrypt-and-MAC.
public HashInfo(int keySize, Func hash, bool isEncryptThenMAC = false)
{
KeySize = keySize;
HashAlgorithm = key => hash(key.Take(KeySize / 8));
IsEncryptThenMAC = isEncryptThenMAC;
}
}
}