From 5a01312454dbfb8f7cd5602c31fe9a73cb652eeb Mon Sep 17 00:00:00 2001 From: "John L. Jegutanis" Date: Tue, 14 Aug 2018 00:17:00 +0200 Subject: [PATCH] Add big endian precompiled structs for 16 & 32 uints --- electrumx/lib/util.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/electrumx/lib/util.py b/electrumx/lib/util.py index c55037a..916ea89 100644 --- a/electrumx/lib/util.py +++ b/electrumx/lib/util.py @@ -335,6 +335,8 @@ struct_le_q = Struct('H') +struct_be_I = Struct('>I') structB = Struct('B') unpack_le_int32_from = struct_le_i.unpack_from @@ -342,12 +344,16 @@ unpack_le_int64_from = struct_le_q.unpack_from unpack_le_uint16_from = struct_le_H.unpack_from unpack_le_uint32_from = struct_le_I.unpack_from unpack_le_uint64_from = struct_le_Q.unpack_from +unpack_be_uint16_from = struct_be_H.unpack_from +unpack_be_uint32_from = struct_be_I.unpack_from pack_le_int32 = struct_le_i.pack pack_le_int64 = struct_le_q.pack pack_le_uint16 = struct_le_H.pack pack_le_uint32 = struct_le_I.pack pack_le_uint64 = struct_le_Q.pack +pack_be_uint16 = struct_be_H.pack +pack_be_uint32 = struct_be_I.pack pack_byte = structB.pack hex_to_bytes = bytes.fromhex