Cipher
using Renci.SshNet.Common;
using Renci.SshNet.Common;
using System.Security.Cryptography;
namespace Renci.SshNet.Security.Cryptography
{
public abstract class Cipher
{
public abstract byte MinimumSize { get; }
public byte[] Encrypt(byte[] input)
{
return Encrypt(input, 0, input.Length);
}
public abstract byte[] Encrypt(byte[] input, int offset, int length);
public abstract byte[] Decrypt(byte[] input);
public abstract byte[] Decrypt(byte[] input, int offset, int length);
}
}
namespace Renci.SshNet.Security.Cryptography
{
public class HMACSHA256 : System.Security.Cryptography.HMACSHA256
{
private readonly int _hashSize;
public override int HashSize => _hashSize;
public HMACSHA256(byte[] key)
: base(key)
{
_hashSize = base.HashSize;
}
public HMACSHA256(byte[] key, int hashSize)
: base(key)
{
_hashSize = hashSize;
}
protected override byte[] HashFinal()
{
return Extensions.Take(base.HashFinal(), HashSize / 8);
}
}
}