diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-08-19 15:13:06 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-08-19 15:13:06 +0700 |
commit | cf1ad240147c298b6adabad399a8bf0f5756f606 (patch) | |
tree | 32c456ebb4e0470df04d6633cac88af2985286b7 /crypto/test/src/util | |
parent | Remove unnecessary TODO (diff) | |
download | BouncyCastle.NET-ed25519-cf1ad240147c298b6adabad399a8bf0f5756f606.tar.xz |
Implement NextBytes(Span<byte)
Diffstat (limited to 'crypto/test/src/util')
-rw-r--r-- | crypto/test/src/util/test/FixedSecureRandom.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/crypto/test/src/util/test/FixedSecureRandom.cs b/crypto/test/src/util/test/FixedSecureRandom.cs index be5b25347..ab74145a4 100644 --- a/crypto/test/src/util/test/FixedSecureRandom.cs +++ b/crypto/test/src/util/test/FixedSecureRandom.cs @@ -226,7 +226,16 @@ namespace Org.BouncyCastle.Utilities.Test _index += len; } - public bool IsExhausted +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public override void NextBytes(Span<byte> buffer) + { + _data.AsSpan(_index, buffer.Length).CopyTo(buffer); + + _index += buffer.Length; + } +#endif + + public bool IsExhausted { get { return _index == _data.Length; } } @@ -248,6 +257,15 @@ namespace Org.BouncyCastle.Utilities.Test index += len; } + +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public override void NextBytes(Span<byte> buffer) + { + data.AsSpan(index, buffer.Length).CopyTo(buffer); + + index += buffer.Length; + } +#endif } private static byte[] ExpandToBitLength(int bitLength, byte[] v) |