diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-04-26 23:09:11 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-04-26 23:09:11 +0700 |
commit | 9111180cdbb9d26de2fac774a82dd7556d610c37 (patch) | |
tree | 00b32124bf6ee37faeca889f04404ef360f109e6 | |
parent | Refactor AsconTest (diff) | |
download | BouncyCastle.NET-ed25519-9111180cdbb9d26de2fac774a82dd7556d610c37.tar.xz |
Add new Pack methods
-rw-r--r-- | crypto/src/crypto/util/Pack.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/crypto/util/Pack.cs b/crypto/src/crypto/util/Pack.cs index a4f8a834f..17bd3681f 100644 --- a/crypto/src/crypto/util/Pack.cs +++ b/crypto/src/crypto/util/Pack.cs @@ -925,6 +925,12 @@ namespace Org.BouncyCastle.Crypto.Utilities BinaryPrimitives.WriteUInt32BigEndian(bs, n); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void UInt32_To_BE(uint n, Span<byte> bs, int off) + { + BinaryPrimitives.WriteUInt32BigEndian(bs[off..], n); + } + internal static void UInt32_To_BE_High(uint n, Span<byte> bs) { int len = bs.Length; @@ -962,6 +968,12 @@ namespace Org.BouncyCastle.Crypto.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void UInt32_To_LE(uint n, Span<byte> bs, int off) + { + BinaryPrimitives.WriteUInt32LittleEndian(bs[off..], n); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void UInt32_To_LE(ReadOnlySpan<uint> ns, Span<byte> bs) { for (int i = 0; i < ns.Length; ++i) @@ -977,6 +989,12 @@ namespace Org.BouncyCastle.Crypto.Utilities BinaryPrimitives.WriteUInt64BigEndian(bs, n); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void UInt64_To_BE(ulong n, Span<byte> bs, int off) + { + BinaryPrimitives.WriteUInt64BigEndian(bs[off..], n); + } + internal static void UInt64_To_BE_High(ulong n, Span<byte> bs) { int len = bs.Length; @@ -1014,6 +1032,12 @@ namespace Org.BouncyCastle.Crypto.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void UInt64_To_LE(ulong n, Span<byte> bs, int off) + { + BinaryPrimitives.WriteUInt64LittleEndian(bs[off..], n); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void UInt64_To_LE(ReadOnlySpan<ulong> ns, Span<byte> bs) { for (int i = 0; i < ns.Length; ++i) |