IXof.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto
  5. {
  6. /// <remarks>
  7. /// With FIPS PUB 202 a new kind of message digest was announced which supported extendable output, or variable digest sizes.
  8. /// This interface provides the extra methods required to support variable output on a digest implementation.
  9. /// </remarks>
  10. public interface IXof
  11. : IDigest
  12. {
  13. /// <summary>
  14. /// Output the results of the final calculation for this XOF to outLen number of bytes.
  15. /// </summary>
  16. /// <param name="output">output array to write the output bytes to.</param>
  17. /// <param name="outOff">offset to start writing the bytes at.</param>
  18. /// <param name="outLen">the number of output bytes requested.</param>
  19. /// <returns>the number of bytes written</returns>
  20. int OutputFinal(byte[] output, int outOff, int outLen);
  21. #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
  22. /// <summary>
  23. /// Output the results of the final calculation for this XOF to fill the output span.
  24. /// </summary>
  25. /// <param name="output">span to fill with the output bytes.</param>
  26. /// <returns>the number of bytes written</returns>
  27. int OutputFinal(Span<byte> output);
  28. #endif
  29. /// <summary>
  30. /// Start outputting the results of the final calculation for this XOF. Unlike DoFinal, this method
  31. /// will continue producing output until the XOF is explicitly reset, or signals otherwise.
  32. /// </summary>
  33. /// <param name="output">output array to write the output bytes to.</param>
  34. /// <param name="outOff">offset to start writing the bytes at.</param>
  35. /// <param name="outLen">the number of output bytes requested.</param>
  36. /// <returns>the number of bytes written</returns>
  37. int Output(byte[] output, int outOff, int outLen);
  38. #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
  39. /// <summary>
  40. /// Start outputting the results of the final calculation for this XOF. Unlike OutputFinal, this method
  41. /// will continue producing output until the XOF is explicitly reset, or signals otherwise.
  42. /// </summary>
  43. /// <param name="output">span to fill with the output bytes.</param>
  44. /// <returns>the number of bytes written</returns>
  45. int Output(Span<byte> output);
  46. #endif
  47. }
  48. }
  49. #pragma warning restore
  50. #endif