diff options
Diffstat (limited to 'crypto/src/crypto/util/Pack.cs')
-rw-r--r-- | crypto/src/crypto/util/Pack.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/crypto/util/Pack.cs b/crypto/src/crypto/util/Pack.cs index dc87cf7d8..99c15484c 100644 --- a/crypto/src/crypto/util/Pack.cs +++ b/crypto/src/crypto/util/Pack.cs @@ -710,6 +710,12 @@ namespace Org.BouncyCastle.Crypto.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static uint BE_To_UInt32(ReadOnlySpan<byte> bs, int off) + { + return BinaryPrimitives.ReadUInt32BigEndian(bs[off..]); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void BE_To_UInt32(ReadOnlySpan<byte> bs, Span<uint> ns) { for (int i = 0; i < ns.Length; ++i) @@ -746,6 +752,12 @@ namespace Org.BouncyCastle.Crypto.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static ulong BE_To_UInt64(ReadOnlySpan<byte> bs, int off) + { + return BinaryPrimitives.ReadUInt64BigEndian(bs[off..]); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void BE_To_UInt64(ReadOnlySpan<byte> bs, Span<ulong> ns) { for (int i = 0; i < ns.Length; ++i) @@ -820,6 +832,12 @@ namespace Org.BouncyCastle.Crypto.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static ulong LE_To_UInt64(ReadOnlySpan<byte> bs, int off) + { + return BinaryPrimitives.ReadUInt64LittleEndian(bs[off..]); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LE_To_UInt64(ReadOnlySpan<byte> bs, Span<ulong> ns) { for (int i = 0; i < ns.Length; ++i) |