diff options
Diffstat (limited to 'crypto/src/crypto/util/SshBuilder.cs')
-rw-r--r-- | crypto/src/crypto/util/SshBuilder.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/src/crypto/util/SshBuilder.cs b/crypto/src/crypto/util/SshBuilder.cs index d631448d5..c2609e3d8 100644 --- a/crypto/src/crypto/util/SshBuilder.cs +++ b/crypto/src/crypto/util/SshBuilder.cs @@ -12,10 +12,16 @@ namespace Org.BouncyCastle.Crypto.Utilities public void U32(uint value) { +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + Span<byte> buf = stackalloc byte[4]; + Pack.UInt32_To_BE(value, buf); + bos.Write(buf); +#else bos.WriteByte(Convert.ToByte(value >> 24 & 0xFF)); bos.WriteByte(Convert.ToByte(value >> 16 & 0xFF)); bos.WriteByte(Convert.ToByte(value >> 8 & 0xFF)); bos.WriteByte(Convert.ToByte(value & 0xFF)); +#endif } public void WriteMpint(BigInteger n) |