IEntropySource.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. /// <summary>
  7. /// Base interface describing an entropy source for a DRBG.
  8. /// </summary>
  9. public interface IEntropySource
  10. {
  11. /// <summary>
  12. /// Return whether or not this entropy source is regarded as prediction resistant.
  13. /// </summary>
  14. /// <value><c>true</c> if this instance is prediction resistant; otherwise, <c>false</c>.</value>
  15. bool IsPredictionResistant { get; }
  16. /// <summary>
  17. /// Return a byte array of entropy.
  18. /// </summary>
  19. /// <returns>The entropy bytes.</returns>
  20. byte[] GetEntropy();
  21. #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
  22. int GetEntropy(Span<byte> output);
  23. #endif
  24. /// <summary>
  25. /// Return the number of bits of entropy this source can produce.
  26. /// </summary>
  27. /// <value>The size, in bits, of the return value of getEntropy.</value>
  28. int EntropySize { get; }
  29. }
  30. }
  31. #pragma warning restore
  32. #endif