// System.Security.Cryptography.ICryptoTransform

#if NET20 || NET40 || NET461

using System;
using System.Runtime.InteropServices;

namespace System.Security.Cryptography
{

    internal class IncrementalHash : HMACSHA1
    {
        bool _finalised;
        public IncrementalHash(byte[] key) : base(key) { }
        public static IncrementalHash CreateHMAC(string n, byte[] key) => new IncrementalHash(key);
        public void AppendData(byte[] buffer, int offset, int count) => TransformBlock(buffer, offset, count, buffer, offset);
        public byte[] GetHashAndReset()
        {
            if (!_finalised)
            {
                byte[] dummy = new byte[0];
                TransformFinalBlock(dummy, 0, 0);
                _finalised = true;
            }
            return Hash;
        }
    }

    internal static class HashAlgorithmName
    {
        public static string SHA1 = null;
    }

}

#endif