You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
928 B

  1. // System.Security.Cryptography.ICryptoTransform
  2. #if NET20 || NET40 || NET461
  3. using System;
  4. using System.Runtime.InteropServices;
  5. namespace System.Security.Cryptography
  6. {
  7. internal class IncrementalHash : HMACSHA1
  8. {
  9. bool _finalised;
  10. public IncrementalHash(byte[] key) : base(key) { }
  11. public static IncrementalHash CreateHMAC(string n, byte[] key) => new IncrementalHash(key);
  12. public void AppendData(byte[] buffer, int offset, int count) => TransformBlock(buffer, offset, count, buffer, offset);
  13. public byte[] GetHashAndReset()
  14. {
  15. if (!_finalised)
  16. {
  17. byte[] dummy = new byte[0];
  18. TransformFinalBlock(dummy, 0, 0);
  19. _finalised = true;
  20. }
  21. return Hash;
  22. }
  23. }
  24. internal static class HashAlgorithmName
  25. {
  26. public static string SHA1 = null;
  27. }
  28. }
  29. #endif