diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-01 19:46:15 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-01 19:46:15 +0700 |
commit | 2f4de05c64ba6653bec38941ba1b66c6e16f05b2 (patch) | |
tree | fc27b837ffdd6e0b399c604db4ed88a035a1d936 /crypto/src/util | |
parent | Port Blake2xsDigest from bc-java (diff) | |
download | BouncyCastle.NET-ed25519-2f4de05c64ba6653bec38941ba1b66c6e16f05b2.tar.xz |
Span-based variant of IRawAgreement.CalculateAgreement
Diffstat (limited to 'crypto/src/util')
-rw-r--r-- | crypto/src/util/Arrays.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index d3dae98a9..25114aca3 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -21,6 +21,18 @@ namespace Org.BouncyCastle.Utilities return bits == 0; } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public static bool AreAllZeroes(ReadOnlySpan<byte> buf) + { + uint bits = 0; + for (int i = 0; i < buf.Length; ++i) + { + bits |= buf[i]; + } + return bits == 0; + } +#endif + public static bool AreEqual( bool[] a, bool[] b) |