将 mp::uint256_t 提升为 Little Endian 字节向量导入/导出

发布于 2025-01-09 03:59:51 字数 2538 浏览 0 评论 0 原文

当(反)序列化 Boost 的多精度整数时,我们很清楚有两种可能性。

  1. 方法一 - 依赖当前后端的实现

     if (bytes.size() < 32) { // 解压存档容器
         字节.resize(32);
         memcpy(bytes.data() + (32 - bytes.size()), bytes.data(),
                字节大小());
     }
    
     if (bytes.size() % sizeof(mp::limb_type))
         抛出 std::Exception("len % sizeof(mp::limb_type)");
     BigInt 我;
     uint32_t 大小 = (uint32_t)bytes.size() / sizeof(mp::limb_type);
     i.backend().resize(大小, 大小);
     memcpy(i.backend().limbs(), bytes.data(), bytes.size());
     i.backend().normalize();
     返回我;
    
  2. <预><代码> BigInt i; { std::vector;字符{bytes.begin(), bytes.end()}; io::stream_buffer; bb(chars.data(), chars.size()); 升压::存档::binary_iarchive ia( bb, ba::no_header | bb, ba::no_header | ba::no_tracking | ba::no_tracking | ba::no_codecvt); ia>>我; }

方法一是不可接受的,因为它依赖于当前的本机字节序和 Boost 的当前实现(正如我们所学到的困难方法)。

第二种方法,除了在序列化时产生奇怪的头字节(我们可以去掉 0,这没有问题),但这也依赖于当前 Boost 的实现。

我们想要的是能够在纯字节向量之间来回执行整数(反)序列化,而无需额外的元数据,以便我们可以对该向量执行任意操作,并放心我们正在操作的是一个普通的、小端编码的整数。再次强调,该方法应保证是 Little Endian 且与当前后端的实现无关。最后,我们希望能够抛出该(Big-Endian 编码)字节向量,并使其再次成为 Boost 的大整数。

当使用序列化接口时,我们不能简单地放置一个 32 字节整数(如一个字节向量)进入反序列化接口,因为它似乎需要额外的元数据/Boost特定格式。

此外,我们不能使用依赖于后端的方法 1,因为我们需要了解当前 Boost 的后端实现和本机字节序。

我们可以在知道本机字节序的情况下手动反转字节序,但是,依赖 Boost 当前后端实现的黑客方法是不可接受的(我们已经通过惨痛的教训了解到它可能会改变)。

文档

那么您将需要创建一个迭代器适配器,将其呈现在 本机顺序(请参阅 Boost.Endian)。

导致空白页。

boosts 文档具体指出:

请注意,此函数针对数据可以的情况进行了优化 从源到整数进行 memcpy - 在这种情况下都是 迭代器大多是指针,并且所有内容都必须是小尾数

可能的解决方案(单行):

export_bits(i, std::back_inserter(字节), 8); 用于序列化 和 import_bits(j, bytes.begin(), bytes.end()); 用于反序列化。

在 Boost 的代码注释中,上面的代码始终首先输出最高有效字节(意味着大端字节序……我们需要小端字节序)。然而..你瞧,同一页面上的相同文档指出,根据平台(Boost.Endian)要使用额外的设备

,上面保证可以在任何平台上输出Big-Endian字节以及 Boost 的未来和过去版本(也许要求太多,但你明白我们的意思)。我们只是依靠特定于后端的解决方案来查看生成的公钥,而不是预期的那样......

然后我们似乎缺少的是输入和输出迭代器的示例在写入每个块之前进行自定义转换。

事实证明...export_bits 和 import_bits 函数有一个 msv_first 标志;只是等待根据一个人想要的字节序被轻弹。

再一次,等待@Sehe,好人的到来..

We are well aware of two possibilities when (de)serializing Boost's multi-precision integers.

  1. method one - rely on the current backends' implementation

     if (bytes.size() < 32) { // unpack the archived container
         bytes.resize(32);
         memcpy(bytes.data() + (32 - bytes.size()), bytes.data(),
                bytes.size());
     }
    
     if (bytes.size() % sizeof(mp::limb_type))
         throw std::exception("len % sizeof(mp::limb_type)");
     BigInt   i;
     uint32_t size = (uint32_t)bytes.size() / sizeof(mp::limb_type);
     i.backend().resize(size, size);
     memcpy(i.backend().limbs(), bytes.data(), bytes.size());
     i.backend().normalize();
     return i;
    
  2. by using the serialization interface.

     BigInt i;
     {
         std::vector<char> chars{bytes.begin(), bytes.end()};
         io::stream_buffer<io::array_source> bb(chars.data(), chars.size());
         boost::archive::binary_iarchive     ia(
             bb, ba::no_header | ba::no_tracking | ba::no_codecvt);
         ia >> i;
     }
    

Method one is unacceptable as it relies on both the current native endianness and the current implementation of Boost (as we've learned the Hard Way).

The second method, besides producing strange header bytes when serializing (we can get rid of 0s that's no problem) but yet again this also relies on current Boost's implementation.

What we want is the ability to perform back and forth (de)serialization of integers, to and from a plain byte vector, with no additional meta-data, so that we could perform arbitrary operations on that vector and rest assured that what we're manipulating is a plain, little endian-encoded integer. Yet again, the method shall be guaranteed to be both Little Endian and current back-end's implementation agnostic. At the end, we want to be able to throw that (Big-Endian encoded) byte vector and make it a Boost's Big Integer yet again.

When using the serialize interface we can't simply put a 32byte integer (as a byte vector) into the deserialize interface as it seemingly expects additional meta-data/Boost-specific format.

Also we can't use method 1 relying on backend as we would need to be aware o both the current Boost's backend implementation and the native endianness.

We could reverse endianness manually knowing the native endianness, still, the hacky approach of relying on Boost's current backends' implementation in not acceptable (we've already learned the hard way that it MAY change).

The documentation says

then you will need to create an iterator adaptor that presents it in
native order (see Boost.Endian).

leading to a blank page.

The boosts documentation states specifically:

Note that this function is optimized for the case where the data can
be memcpy'ed from the source to the integer - in this case both
iterators much be pointers, and everything must be little-endian

Possible solution (a one-liner):

export_bits(i, std::back_inserter(bytes), 8);
for serialization
and
import_bits(j, bytes.begin(), bytes.end());
for deserialization.

In Boost's in-code comments state that the above outputs Most-Significant bytes first ALWAYS (meaning Big Endian ... we need little endian). YET.. lo and behold same documentation on the vert same page states that additional apparatus is to be used depending on platform (the Boost.Endian)

is the above guaranteed to output Big-Endian bytes on any platform and across future and past versions of Boost (maybe asking too much but you get our point). We just relied on the backend-specific solution just to see public-keys generated not as they were expected to be...........

What we seem to be missing then is an example of both input and output iterators doing custom conversion before each chunk is written.

As it turns out... the export_bits and import_bits functions have a msv_first flag ; just waiting to be flicked depending on the endianness one desires.

Yet again, waiting for @Sehe, the Good Folk to come around..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2025-01-16 03:59:51

暂时假设 BigInt 是 boost::multi precision::cpp_int 的别名:

#include <boost/endian/arithmetic.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <fmt/ranges.h>
#include <span>
namespace mp = boost::multiprecision;
using BigInt = mp::cpp_int;

template <typename T, typename Out> Out save(BigInt const& number, Out out)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    return mp::export_bits(number, out, sizeof(T)*CHAR_BIT);
}

int main() {
    BigInt i = pow(BigInt(42), 69);

    std::vector<uint32_t>                    native;
    std::vector<boost::endian::big_uint32_t> network;

    save<uint32_t>(i, back_inserter(native));
    save<boost::endian::big_uint32_t>(i, back_inserter(network));

    fmt::print("i {}\n", i.str());
    fmt::print("native {::02x}\n", std::as_bytes(std::span(native)));
    fmt::print("network {::02x}\n", std::as_bytes(std::span(network)));
}

Prints

i 10097201832880355573875790863214833226896186369872326994250398570376877433686009543845316266007917815719968899072
native [59, cb, 10, 00, 3c, d7, e0, 15, 32, 49, 72, a9, 2e, b3, 77, ae, 89, f4, 08, 01, 00, 95, 30, d8, 20, 68, 31, 57, fe, 7a, 79, c9, de, 72, df, ec, a0, 10, 7a, 86, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 10, cb, 59, 15, e0, d7, 3c, a9, 72, 49, 32, ae, 77, b3, 2e, 01, 08, f4, 89, d8, 30, 95, 00, 57, 31, 68, 20, c9, 79, 7a, fe, ec, df, 72, de, 86, 7a, 10, a0, 00, 00, 00, 00, 00, 00, 00, 00]

当然,加载也是类似的。遗憾的是,我们必须向 Boost Multi precision 传授有关 big_uint32_t1 的知识:

template <> struct mp::detail::make_unsigned<be::big_uint32_t> {
    using type = be::big_uint32_t;
};

但它只是:

template <typename R = BigInt, typename T> R load(std::span<T> in)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    R number;
    mp::import_bits(number, in.begin(), in.end(), sizeof(T) * CHAR_BIT);
    return number;
}

现场演示

Live On Compiler Explorer

#include <boost/endian/arithmetic.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <fmt/ranges.h>
#include <span>

namespace mp = boost::multiprecision;
namespace be = boost::endian;
using BigInt = mp::cpp_int;

template <> struct mp::detail::make_unsigned<be::big_uint32_t> {
    using type = be::big_uint32_t;
};

template <typename T, typename Out> Out save(BigInt const& number, Out out)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    return mp::export_bits(number, out, sizeof(T) * CHAR_BIT);
}

template <typename R = BigInt, typename T> R load(std::span<T> in)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    R number;
    mp::import_bits(number, in.begin(), in.end(), sizeof(T) * CHAR_BIT);
    return number;
}

int main() {
    for (int exp = 1;  exp <= 69; ++exp) {
        BigInt i = pow(BigInt(42), exp);

        std::vector<uint32_t>                    native;
        std::vector<boost::endian::big_uint32_t> network;

        save<uint32_t>(i, back_inserter(native));
        save<boost::endian::big_uint32_t>(i, back_inserter(network));

        fmt::print("i {}\n", i.str());
        fmt::print("native {::02x}\n", std::as_bytes(std::span(native)));
        fmt::print("network {::02x}\n", std::as_bytes(std::span(network)));

        auto from_native  = load(std::span(native));
        auto from_network = load(std::span(network));
        fmt::print("from_native equal: {}\n", from_native == i);
        fmt::print("from_network equal: {}\n", from_network == i);
    }
}

打印

i 42
native [2a, 00, 00, 00]
network [00, 00, 00, 2a]
from_native equal: true
from_network equal: true
i 1764
native [e4, 06, 00, 00]
network [00, 00, 06, e4]
from_native equal: true
from_network equal: true
i 74088
native [68, 21, 01, 00]
network [00, 01, 21, 68]
from_native equal: true
from_network equal: true
i 3111696
native [10, 7b, 2f, 00]
network [00, 2f, 7b, 10]
from_native equal: true
from_network equal: true
i 130691232
native [a0, 30, ca, 07]
network [07, ca, 30, a0]
from_native equal: true
from_network equal: true
i 5489031744
native [01, 00, 00, 00, 40, fa, 2b, 47]
network [00, 00, 00, 01, 47, 2b, fa, 40]
from_native equal: true
from_network equal: true
i 230539333248
native [35, 00, 00, 00, 80, 0e, 37, ad]
network [00, 00, 00, 35, ad, 37, 0e, 80]
from_native equal: true
from_network equal: true
i 9682651996416
native [ce, 08, 00, 00, 00, 61, 08, 6b]
network [00, 00, 08, ce, 6b, 08, 61, 00]
from_native equal: true
from_network equal: true
i 406671383849472
native [dd, 71, 01, 00, 00, ea, 5f, 8f]
network [00, 01, 71, dd, 8f, 5f, ea, 00]
from_native equal: true
from_network equal: true
i 17080198121677824
native [59, ae, 3c, 00, 00, 64, bc, 85]
network [00, 3c, ae, 59, 85, bc, 64, 00]
from_native equal: true
from_network equal: true
i 717368321110468608
native [af, 9a, f4, 09, 00, 68, e8, f0]
network [09, f4, 9a, af, f0, e8, 68, 00]
from_native equal: true
from_network equal: true
i 30129469486639681536
native [01, 00, 00, 00, dd, 60, 21, a2, 00, 10, 21, 86]
network [00, 00, 00, 01, a2, 21, 60, dd, 86, 21, 10, 00]
from_native equal: true
from_network equal: true
i 1265437718438866624512
native [44, 00, 00, 00, 58, e4, 79, 99, 00, a0, 6c, 01]
network [00, 00, 00, 44, 99, 79, e4, 58, 01, 6c, a0, 00]
from_native equal: true
from_network equal: true
i 53148384174432398229504
native [41, 0b, 00, 00, 70, 76, ff, 2d, 00, 40, d2, 3b]
network [00, 00, 0b, 41, 2d, ff, 76, 70, 3b, d2, 40, 00]
from_native equal: true
from_network equal: true
i 2232232135326160725639168
native [b1, d8, 01, 00, 69, 6e, e9, 8b, 00, 80, 7e, d0]
network [00, 01, d8, b1, 8b, e9, 6e, 69, d0, 7e, 80, 00]
from_native equal: true
from_network equal: true
i 93753749683698750476845056
native [20, 8d, 4d, 00, 5c, 1d, 4c, f4, 00, 00, c1, 34]
network [00, 4d, 8d, 20, f4, 4c, 1d, 5c, 34, c1, 00, 00]
from_native equal: true
from_network equal: true
i 3937657486715347520027492352
native [68, 27, b9, 0c, 20, d1, 7c, 14, 00, 00, aa, a7]
network [0c, b9, 27, 68, 14, 7c, d1, 20, a7, aa, 00, 00]
from_native equal: true
from_network equal: true
i 165381614442044595841154678784
native [02, 00, 00, 00, 13, 77, 60, 16, 5b, 4f, 7a, 5c, 00, 00, e4, 81]
network [00, 00, 00, 02, 16, 60, 77, 13, 5c, 7a, 4f, 5b, 81, e4, 00, 00]
from_native equal: true
from_network equal: true
i 6946027806565873025328496508928
native [57, 00, 00, 00, 2d, 89, d3, ab, 03, 05, 11, 2c, 00, 00, 68, 4f]
network [00, 00, 00, 57, ab, d3, 89, 2d, 2c, 11, 05, 03, 4f, 68, 00, 00]
from_native equal: true
from_network equal: true
i 291733167875766667063796853374976
native [62, 0e, 00, 00, 69, 81, b4, 30, 8b, d2, ca, 3a, 00, 00, 10, 07]
network [00, 00, 0e, 62, 30, b4, 81, 69, 3a, ca, d2, 8b, 07, 10, 00, 00]
from_native equal: true
from_network equal: true
i 12252793050782200016679467841748992
native [1b, 5c, 02, 00, 43, 3b, 9d, fd, cf, 8a, 46, a5, 00, 00, a0, 28]
network [00, 02, 5c, 1b, fd, 9d, 3b, 43, a5, 46, 8a, cf, 28, a0, 00, 00]
from_native equal: true
from_network equal: true
i 514617308132852400700537649353457664
native [97, 1c, 63, 00, 19, b9, cb, 9b, fc, c5, 92, 1d, 00, 00, 40, aa]
network [00, 63, 1c, 97, 9b, cb, b9, 19, 1d, 92, c5, fc, aa, 40, 00, 00]
from_native equal: true
from_network equal: true
i 21613926941579800829422581272845221888
native [df, b0, 42, 10, 1e, 5e, 6c, 8f, 73, 7b, 14, da, 00, 00, 80, ee]
network [10, 42, b0, df, 8f, 6c, 5e, 1e, da, 14, 7b, 73, ee, 80, 00, 00]
from_native equal: true
from_network equal: true
i 907784931546351634835748413459499319296
native [02, 00, 00, 00, ad, 04, f1, aa, 0f, 71, c7, 87, 05, 41, 5c, c7, 00, 00, 00, 21]
network [00, 00, 00, 02, aa, f1, 04, ad, 87, c7, 71, 0f, c7, 5c, 41, 05, 21, 00, 00, 00]
from_native equal: true
from_network equal: true
i 38126967124946768663101433365298971410432
native [70, 00, 00, 00, 78, c4, 8a, 0b, 96, 8c, b8, 46, d7, aa, 22, b5, 00, 00, 00, 6a]
network [00, 00, 00, 70, 0b, 8a, c4, 78, 46, b8, 8c, 96, b5, 22, aa, d7, 6a, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1601332619247764283850260201342556799238144
native [61, 12, 00, 00, bb, 3b, c4, e4, b9, 10, 47, 9a, 57, 07, b0, b7, 00, 00, 00, 64]
network [00, 00, 12, 61, e4, c4, 3b, bb, 9a, 47, 10, b9, b7, b0, 07, 57, 64, 00, 00, 00]
from_native equal: true
from_network equal: true
i 67255970008406099921710928456387385568002048
native [0f, 04, 03, 00, c7, cc, 31, 88, 78, be, a8, 4f, 56, 34, e1, 22, 00, 00, 00, 68]
network [00, 03, 04, 0f, 88, 31, cc, c7, 4f, a8, be, 78, 22, e1, 34, 56, 68, 00, 00, 00]
from_native equal: true
from_network equal: true
i 2824750740353056196711858995168270193856086016
native [8c, aa, 7e, 00, b3, 98, 2b, 58, b5, 3f, af, 11, 2d, 96, f2, b8, 00, 00, 00, 10]
network [00, 7e, aa, 8c, 58, 2b, 98, b3, 11, af, 3f, b5, b8, f2, 96, 2d, 10, 00, 00, 00]
from_native equal: true
from_network equal: true
i 118639531094828360261898077797067348141955612672
native [06, fb, c7, 14, 60, 0d, 27, 77, d0, 73, c0, e6, 64, a3, cc, 57, 00, 00, 00, a0]
network [14, c7, fb, 06, 77, 27, 0d, 60, e6, c0, 73, d0, 57, cc, a3, 64, a0, 00, 00, 00]
from_native equal: true
from_network equal: true
i 4982860305982791130999719267476828621962135732224
native [03, 00, 00, 00, 0f, 2f, cf, 68, e5, 31, 68, 8c, 2e, 00, 93, db, 82, ce, 92, 67, 00, 00, 00, 40]
network [00, 00, 00, 03, 68, cf, 2f, 0f, 8c, 68, 31, e5, db, 93, 00, 2e, 67, 92, ce, 82, 40, 00, 00, 00]
from_native equal: true
from_network equal: true
i 209280132851277227501988209234026802122409700753408
native [8f, 00, 00, 00, 8d, b8, fd, 31, b6, 2f, 18, 09, 9c, 07, 1e, 06, 5e, e1, 15, fe, 00, 00, 00, 80]
network [00, 00, 00, 8f, 31, fd, b8, 8d, 09, 18, 2f, b6, 06, 1e, 07, 9c, fe, 15, e1, 5e, 80, 00, 00, 00]
from_native equal: true
from_network equal: true
i 8789765579753643555083504787829125689141207431643136
native [7e, 17, 00, 00, 23, 47, a0, 33, dd, d3, f7, 7d, c1, 3f, ed, 00, 81, f9, 96, af, 00, 00, 00, 00]
network [00, 00, 17, 7e, 33, a0, 47, 23, 7d, f7, d3, dd, 00, ed, 3f, c1, af, 96, f9, 81, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 369170154349653029313507201088823278943930712129011712
native [b4, da, 03, 00, d2, ab, 4b, 78, 42, c2, a8, aa, c6, 75, ec, 26, 2a, ef, c4, ce, 00, 00, 00, 00]
network [00, 03, da, b4, 78, 4b, ab, d2, aa, a8, c2, 42, 26, ec, 75, c6, ce, c4, ef, 2a, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 15505146482685427231167302445730577715645089909418491904
native [9b, e1, a1, 00, 8f, 30, 6a, bc, da, de, af, ff, 9d, 52, cb, 62, e4, 3c, 4f, ec, 00, 00, 00, 00]
network [00, a1, e1, 9b, bc, 6a, 30, 8f, ff, af, de, da, 62, cb, 52, 9d, ec, 4f, 3c, e4, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 651216152272787943709026702720684264057093776195576659968
native [8c, 03, 8f, 1a, 9f, f7, 6b, e9, d4, 8f, da, f2, e8, 8d, 5b, 35, 68, fd, ff, c4, 00, 00, 00, 00]
network [1a, 8f, 03, 8c, e9, 6b, f7, 9f, f2, da, 8f, d4, 35, 5b, 8d, e8, c4, ff, fd, 68, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 27351078395457093635779121514268739090397938600214219718656
native [04, 00, 00, 00, 1e, 95, 76, 5b, 3d, a0, b6, 4b, d0, 98, db, d7, 30, 48, 05, c1, 10, 93, ff, 51, 00, 00, 00, 00]
network [00, 00, 00, 04, 5b, 76, 95, 1e, 4b, b6, a0, 3d, d7, db, 98, d0, c1, 05, 48, 30, 51, ff, 93, 10, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1148745292609197932702723103599287041796713421208997228183552
native [b7, 00, 00, 00, f8, 76, 74, 01, 25, 4a, f6, 6b, 3f, 12, 07, 6a, ed, d7, dd, aa, a0, 20, ee, 73, 00, 00, 00, 00]
network [00, 00, 00, b7, 01, 74, 76, f8, 6b, f6, 4a, 25, 6a, 07, 12, 3f, aa, dd, d7, ed, 73, ee, 20, a0, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 48247302289586313173514370351170055755461963690777883583709184
native [06, 1e, 00, 00, c1, 84, 1b, 3d, 23, 2a, 68, b6, 72, fe, 28, 65, f5, 6c, 65, 08, 40, 5a, 11, 05, 00, 00, 00, 00]
network [00, 00, 1e, 06, 3d, 1b, 84, c1, b6, 68, 2a, 23, 65, 28, fe, 72, 08, 65, 6c, f5, 05, 11, 5a, 40, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 2026386696162625153287603554749142341729402475012671110515785728
native [06, ed, 04, 00, c7, c7, 83, 06, ce, e9, 16, ed, b5, be, b9, 98, 32, e0, a3, 60, 80, ce, d8, d4, 00, 00, 00, 00]
network [00, 04, ed, 06, 06, 83, c7, c7, ed, 16, e9, ce, 98, b9, be, b5, 60, a3, e0, 32, d4, d8, ce, 80, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 85108241238830256438079349299463978352634903950532186641663000576
native [fd, e2, ce, 00, cc, c6, 9e, 11, e5, 5b, c2, e5, c1, 49, 79, 0e, 56, c8, e2, da, 00, e1, 91, eb, 00, 00, 00, 00]
network [00, ce, e2, fd, 11, 9e, c6, cc, e5, c2, 5b, e5, 0e, 79, 49, c1, da, e2, c8, 56, eb, 91, e1, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 3574546132030870770399332670577487090810665965922351838949846024192
native [84, 3d, f1, 21, 9d, 9d, 0c, e4, 94, 13, e3, b1, cd, 19, e6, 5f, 42, de, 34, e9, 00, ea, ee, a5, 00, 00, 00, 00]
network [21, f1, 3d, 84, e4, 0c, 9d, 9d, b1, e3, 13, 94, 5f, e6, 19, cd, e9, 34, de, 42, a5, ee, ea, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 150130937545296572356771972164254457814047970568738777235893533016064
native [05, 00, 00, 00, cd, 17, 94, 91, df, db, 11, 6a, 57, 36, 41, 2f, c8, 3b, c0, bb, ef, 76, ac, 42, 00, 64, 32, 39, 00, 00, 00, 00]
network [00, 00, 00, 05, 91, 94, 17, cd, 6a, 11, db, df, 2f, 41, 36, 57, bb, c0, 3b, c8, 42, ac, 76, ef, 39, 32, 64, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 6305499376902456038984422830898687228190014763887028643907528386674688
native [e9, 00, 00, 00, b3, e7, 4b, e2, 9d, 12, ee, 66, 64, ea, b2, c0, da, ce, 89, cd, 3f, 83, 4b, f0, 00, 68, 44, 62, 00, 00, 00, 00]
network [00, 00, 00, e9, e2, 4b, e7, b3, 66, ee, 12, 9d, c0, b2, ea, 64, cd, 89, ce, da, f0, 4b, 83, 3f, 62, 44, 68, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 264830973829903153637345758897744863583980620083255203044116192240336896
native [5f, 26, 00, 00, 6e, 03, 74, 20, e1, 0d, 0f, e3, 89, 74, 5a, 9d, eb, ef, 9b, b8, 66, 88, 63, 6c, 00, 10, 39, 1f, 00, 00, 00, 00]
network [00, 00, 26, 5f, 20, 74, 03, 6e, e3, 0f, 0d, e1, 9d, 5a, 74, 89, b8, 9b, ef, eb, 6c, 63, 88, 66, 1f, 39, 10, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 11122900900855932452768521873705284270527186043496718527852880074094149632
native [9b, 4b, 06, 00, 31, 90, 08, 53, 03, 47, 78, 40, 98, 1e, d7, d0, 9f, 5c, 95, 49, c1, 60, 54, c8, 00, a0, 5c, 1f, 00, 00, 00, 00]
network [00, 06, 4b, 9b, 53, 08, 90, 31, 40, 78, 47, 03, d0, d7, 1e, 98, 49, 95, 5c, 9f, c8, 54, 60, c1, 1f, 5c, a0, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 467161837835949163016277918695621939362141813826862178169820963111954284544
native [7b, 67, 08, 01, 14, a8, 67, 9f, a0, a6, bb, 93, fc, 04, 4b, 43, 36, 32, 81, 12, af, df, d7, dd, 00, 40, 32, 25, 00, 00, 00, 00]
network [01, 08, 67, 7b, 9f, 67, a8, 14, 93, bb, a6, a0, 43, 4b, 04, fc, 12, 81, 32, 36, dd, d7, df, af, 25, 32, 40, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 19620797189109864846683672585216121453209956180728211483132480450702079950848
native [48, fa, 60, 2b, 60, 93, 01, 27, 4b, 56, c9, 3c, 5b, d1, 4e, 0a, 00, 3d, 32, 09, bc, b2, 6a, 65, 00, 80, 3e, 1a, 00, 00, 00, 00]
network [2b, 60, fa, 48, 27, 01, 93, 60, 3c, c9, 56, 4b, 0a, 4e, d1, 5b, 09, 32, 3d, 00, 65, 6a, b2, bc, 1a, 3e, 80, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 824073481942614323560714248579077101034818159590584882291564178929487357935616
native [07, 00, 00, 00, d6, 0f, e9, 1d, c9, 2d, 42, 66, 4f, 28, 08, f9, ef, 58, ee, b0, 10, 02, 3e, 82, dc, 52, 81, a3, 00, 00, 41, 4e, 00, 00, 00, 00]
network [00, 00, 00, 07, 1d, e9, 0f, d6, 66, 42, 2d, c9, f9, 08, 28, 4f, b0, ee, 58, ef, 82, 3e, 02, 10, a3, 81, 52, dc, 4e, 41, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 34611086241589801589549998440321238243462362702804565056245695515038469033295872
native [2a, 01, 00, 00, 2c, 99, 3c, e8, 22, 83, db, c6, 13, 9d, 56, db, 4b, 97, 1a, 07, ba, 56, 2c, 5e, 24, 98, 37, d3, 00, 00, aa, d6, 00, 00, 00, 00]
network [00, 00, 01, 2a, e8, 3c, 99, 2c, c6, db, 83, 22, db, 56, 9d, 13, 07, 1a, 97, 4b, 5e, 2c, 56, ba, d3, 37, 98, 24, d6, aa, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1453665622146771666761099934493492006225419233517791732362319211631615699398426624
native [0a, 31, 00, 00, 58, 21, f1, 19, b7, 83, 03, a0, 1f, c5, 35, fc, 5d, d2, 5c, 2a, a6, 3a, 46, 73, 0b, f6, 1e, a7, 00, 00, e4, 37, 00, 00, 00, 00]
network [00, 00, 31, 0a, 19, f1, 21, 58, a0, 03, 83, b7, fc, 35, c5, 1f, 2a, 5c, d2, 5d, 73, 46, 3a, a6, a7, 1e, f6, 0b, 37, e4, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 61053956130164410003966197248726664261467607807747252759217406888527859374733918208
native [a8, 0b, 08, 00, 8a, 78, 8f, 41, 2f, 9c, 93, 40, 1c, 57, d2, 60, 54, 83, 3a, f3, 57, 9f, 85, e9, d7, 5d, 14, 6b, 00, 00, 68, 2b, 00, 00, 00, 00]
network [00, 08, 0b, a8, 41, 8f, 78, 8a, 40, 93, 9c, 2f, 60, d2, 57, 1c, f3, 3a, 83, 54, e9, 85, 9f, 57, 6b, 14, 5d, d7, 2b, 68, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 2564266157466905220166580284446519898981639527925384615887131089318170093738824564736
native [9a, e9, 51, 01, ae, c6, 89, c1, c5, 9f, 37, 98, bf, 4a, 82, e2, ee, 8b, 99, e7, 57, 24, ec, 4f, 4d, 65, 57, 91, 00, 00, 10, 1f, 00, 00, 00, 00]
network [01, 51, e9, 9a, c1, 89, c6, ae, 98, 37, 9f, c5, e2, 82, 4a, bf, e7, 99, 8b, ee, 4f, ec, 24, 57, 91, 57, 65, 4d, 1f, 10, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 107699178613610019246996371946753835757228860172866153867259505751363143937030631718912
native [63, 53, 70, 37, a4, 98, 9a, c0, 77, 36, 20, f9, 7b, 43, 60, 29, 19, f5, 30, ff, 5d, f6, bd, 1c, a7, 9e, 56, d8, 00, 00, a0, 18, 00, 00, 00, 00]
network [37, 70, 53, 63, c0, 9a, 98, a4, f9, 20, 36, 77, 29, 60, 43, 7b, ff, 30, f5, 19, 1c, bd, f6, 5d, d8, 56, 9e, a7, 18, a0, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 4523365501771620808373847621763661101803612127260378462424899241557252045355286532194304
native [09, 00, 00, 00, 5d, ae, 6d, 18, 10, 0b, 5d, 99, 8c, ef, 48, df, 57, 12, cb, c9, 1e, 36, 08, de, 65, 6b, 2a, b7, 6a, 07, 36, 7e, 00, 00, 40, 0a, 00, 00, 00, 00]
network [00, 00, 00, 09, 18, 6d, ae, 5d, 99, 5d, 0b, 10, df, 48, ef, 8c, c9, cb, 12, 57, de, 08, 36, 1e, b7, 2a, 6b, 65, 7e, 36, 07, 6a, 0a, 40, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 189981351074408073951701600114073766275751709344935895421845768145404585904922034352160768
native [7e, 01, 00, 00, 5b, 9b, fe, 01, c4, d0, 43, 29, 19, 4d, f7, a1, 6a, 02, 51, 1b, 0a, e1, 58, 6d, a6, 9e, f5, 0c, 65, 37, dd, b4, 00, 00, 80, ae, 00, 00, 00, 00]
network [00, 00, 01, 7e, 01, fe, 9b, 5b, 29, 43, d0, c4, a1, f7, 4d, 19, 1b, 51, 02, 6a, 6d, 58, e1, 0a, 0c, f5, 9e, a6, b4, dd, 37, 65, ae, 80, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 7979216745125139105971467204791098183581571792487307607717522262106992608006725442790752256
native [ac, 3e, 00, 00, f4, 7c, c5, 53, 42, 40, 20, c5, 1e, a6, 92, 92, 75, 65, 4a, 7b, a6, eb, 94, f0, 59, 07, 4c, 20, ae, 16, 4b, ac, 00, 00, 00, a1, 00, 00, 00, 00]
network [00, 00, 3e, ac, 53, c5, 7c, f4, c5, 20, 40, 42, 92, 92, a6, 1e, 7b, 4a, 65, 75, f0, 94, eb, a6, 20, 4c, 07, 59, ac, 4b, 16, ae, a1, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 335127103295255842450801622601226123710426015284466919524135935008493689536282468597211594752
native [45, 48, 0a, 00, 28, 80, 66, be, ec, 8a, 4a, 57, 00, 41, 0f, 0c, 59, a5, 34, 3a, 41, a9, 6e, 78, b6, 34, 79, 4c, a6, b8, 51, 44, 00, 00, 00, 6a, 00, 00, 00, 00]
network [00, 0a, 48, 45, be, 66, 80, 28, 57, 4a, 8a, ec, 0c, 0f, 41, 00, 3a, 34, a5, 59, 78, 6e, a9, 41, 4c, 79, 34, b6, 44, 51, b8, a6, 6a, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 14075338338400745382933668149251497195837892641947610620013709270356734960523863681082886979584
native [71, db, af, 01, 9e, 06, d1, 3c, b9, ca, 3a, 52, 09, aa, 80, fa, ad, 20, a3, 8c, b6, c4, 27, c2, e7, a5, e2, 8b, 4d, 4b, 68, 35, 00, 00, 00, 64, 00, 00, 00, 00]
network [01, af, db, 71, 3c, d1, 06, 9e, 52, 3a, ca, b9, fa, 80, aa, 09, 8c, a3, 20, ad, c2, 27, c4, b6, 8b, e2, a5, e7, 35, 68, 4b, 4d, 64, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 591164210212831306083214062268562882225191490961799646040575789354982868342002274605481253142528
native [93, 00, da, 46, f9, 15, 4b, fa, 83, 42, a5, 7d, 91, e5, 1b, 19, 81, 5c, c3, 12, f2, 45, 86, da, ee, 37, 2f, f3, b2, 5a, 1c, c3, 00, 00, 00, 68, 00, 00, 00, 00]
network [46, da, 00, 93, fa, 4b, 15, f9, 7d, a5, 42, 83, 19, 1b, e5, 91, 12, c3, 5c, 81, da, 86, 45, f2, f3, 2f, 37, ee, c3, 1c, 5a, b2, 68, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 24828896828938914855494990615279641053458042620395585133704183152909280470364095533430212631986176
native [0b, 00, 00, 00, 47, 18, c4, 9f, ee, 9a, 51, 10, 82, e9, 1c, 9d, cd, a9, 93, 1e, 4d, 2d, 0d, 14, db, 79, 07, da, 2c, 2d, bf, e5, 45, e1, a6, 02, 00, 00, 00, 10, 00, 00, 00, 00]
network [00, 00, 00, 0b, 9f, c4, 18, 47, 10, 51, 9a, ee, 9d, 1c, e9, 82, 1e, 93, a9, cd, 14, 0d, 2d, 4d, da, 07, 79, db, e5, bf, 2d, 2c, 02, a6, e1, 45, 10, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1042813666815434423930789605841744924245237790056614575615575692422189779755292012404068930543419392
native [e8, 01, 00, 00, a8, fb, 2b, 36, 25, 6b, 63, ad, 59, 4f, be, c6, a5, db, 39, 04, c5, 6e, 29, 4a, 13, fe, 39, c5, 38, 69, 5d, b1, 54, f5, 60, 6f, 00, 00, 00, a0, 00, 00, 00, 00]
network [00, 00, 01, e8, 36, 2b, fb, a8, ad, 63, 6b, 25, c6, be, 4f, 59, 04, 39, db, a5, 4a, 29, 6e, c5, c5, 39, fe, 13, b1, 5d, 69, 38, 6f, 60, f5, 54, a0, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 43798174006248245805093163445353286818299987182377812175854179081731970749722264520970895082823614464
native [18, 50, 00, 00, ac, 49, 37, e3, 32, 94, 4f, 72, 9a, 04, 39, 9b, 1e, 09, 7e, b1, 72, 2c, cc, 2a, 3b, af, 83, 5b, 42, 43, 53, 19, e2, 3f, e8, 45, 00, 00, 00, 40, 00, 00, 00, 00]
network [00, 00, 50, 18, e3, 37, 49, ac, 72, 4f, 94, 32, 9b, 39, 04, 9a, b1, 7e, 09, 1e, 2a, cc, 2c, 72, 5b, 83, af, 3b, 19, 53, 43, 42, 45, e8, 3f, e2, 40, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1839523308262426323813912864704838046368599461659868111385875521432742771488335109880777593478591807488
native [15, 24, 0d, 00, 4a, 16, 12, 47, 4d, 50, 0e, c1, 61, c1, 5a, 77, f3, 7e, ad, 1e, c3, 4a, 7f, 05, b2, bf, 9a, 03, df, 08, a9, 27, 1e, 7b, 1a, 78, 00, 00, 00, 80, 00, 00, 00, 00]
network [00, 0d, 24, 15, 47, 12, 16, 4a, c1, 0e, 50, 4d, 77, 5a, c1, 61, 1e, ad, 7e, f3, 05, 7f, 4a, c3, 03, 9a, bf, b2, 27, a9, 08, df, 78, 1a, 7b, 1e, 80, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 77259978947021905600184340317603197947481177389714460678206771900175196402510074614992658926100855914496
native [7d, eb, 27, 02, 43, a8, f7, a8, b5, 2c, 59, ac, ef, b9, e3, 94, de, d3, 76, 08, fe, 43, e2, e6, 3a, 73, 63, 97, a9, 74, bb, 81, 01, 33, 58, b4, 00, 00, 00, 00, 00, 00, 00, 00]
network [02, 27, eb, 7d, a8, f7, a8, 43, ac, 59, 2c, b5, 94, e3, b9, ef, 08, 76, d3, de, e6, e2, 43, fe, 97, 63, 73, 3a, 81, bb, 74, a9, b4, 58, 33, 01, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 3244919115774920035207742293339334313794209450368007348484684419807358248905423133829691674896235948408832
native [9d, a2, 8c, 5a, 1a, 9b, a1, b8, ca, 55, a1, 46, 37, 81, 5c, 6d, 91, c2, 7e, 63, c4, 27, 1f, e1, 99, e7, 50, d6, d7, 23, c1, 48, 2a, 5e, 78, 96, 00, 00, 00, 00, 00, 00, 00, 00]
network [5a, 8c, a2, 9d, b8, a1, 9b, 1a, 46, a1, 55, ca, 6d, 5c, 81, 37, 63, 7e, c2, 91, e1, 1f, 27, c4, d6, 50, e7, 99, 48, c1, 23, d7, 96, 78, 5e, 2a, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 136286602862546641478725176320252041179356796915456308636356745631909046454027771620847050345641909833170944
native [0e, 00, 00, 00, e0, ad, 12, db, 4f, 72, 83, 4a, 35, 13, 78, 96, 16, 33, 2d, f1, ee, eb, cb, 52, 4b, 86, 1c, ef, 25, ff, 45, 29, 5e, e1, af, ef, e4, 72, bf, af, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 00, 00, 0e, db, 12, ad, e0, 4a, 83, 72, 4f, 96, 78, 13, 35, f1, 2d, 33, 16, 52, cb, eb, ee, ef, 1c, 86, 4b, 29, 45, ff, 25, ef, af, e1, 5e, af, bf, 72, e4, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 5724037320226958942106457405450585729532985470449164962726983316540179951069166408075576114516960212993179648
native [6f, 02, 00, 00, cc, 86, 10, f1, 0e, c1, 90, 39, d9, 26, b3, af, a9, 61, 6a, 91, 33, b5, 74, 95, 54, 08, ae, 3a, 39, dc, 7b, c5, 88, f9, da, 52, 68, d9, 68, d5, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 00, 02, 6f, f1, 10, 86, cc, 39, 90, c1, 0e, af, b3, 26, d9, 91, 6a, 61, a9, 95, 74, b5, 33, 3a, ae, 08, 54, c5, 7b, dc, 39, 52, da, f9, 88, d5, 68, d9, 68, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 240409567449532275568471211028924600640385389758864928434533299294687557944904989139174196809712328945713545216
native [5d, 66, 00, 00, 81, 1d, b6, 8c, 68, ac, bf, 71, b1, 5f, 64, d3, d2, 05, 74, db, 67, ba, 25, 85, e8, 5d, 8d, a0, 67, 21, 52, 66, 73, f0, ec, 97, 10, ab, 33, 03, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 00, 66, 5d, 8c, b6, 1d, 81, 71, bf, ac, 68, d3, 64, 5f, b1, db, 74, 05, d2, 85, 25, ba, 67, a0, 8d, 5d, e8, 66, 52, 21, 67, 97, ec, f0, 73, 03, 33, ab, 10, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 10097201832880355573875790863214833226896186369872326994250398570376877433686009543845316266007917815719968899072
native [59, cb, 10, 00, 3c, d7, e0, 15, 32, 49, 72, a9, 2e, b3, 77, ae, 89, f4, 08, 01, 00, 95, 30, d8, 20, 68, 31, 57, fe, 7a, 79, c9, de, 72, df, ec, a0, 10, 7a, 86, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 10, cb, 59, 15, e0, d7, 3c, a9, 72, 49, 32, ae, 77, b3, 2e, 01, 08, f4, 89, d8, 30, 95, 00, 57, 31, 68, 20, c9, 79, 7a, fe, ec, df, 72, de, 86, 7a, 10, a0, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true

1 注意:不要专门化 std::make_unsigned: “添加专门化的程序的行为make_unsigned 未定义”

Assuming for the moment that BigInt is an alias for boost::multiprecision::cpp_int:

#include <boost/endian/arithmetic.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <fmt/ranges.h>
#include <span>
namespace mp = boost::multiprecision;
using BigInt = mp::cpp_int;

template <typename T, typename Out> Out save(BigInt const& number, Out out)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    return mp::export_bits(number, out, sizeof(T)*CHAR_BIT);
}

int main() {
    BigInt i = pow(BigInt(42), 69);

    std::vector<uint32_t>                    native;
    std::vector<boost::endian::big_uint32_t> network;

    save<uint32_t>(i, back_inserter(native));
    save<boost::endian::big_uint32_t>(i, back_inserter(network));

    fmt::print("i {}\n", i.str());
    fmt::print("native {::02x}\n", std::as_bytes(std::span(native)));
    fmt::print("network {::02x}\n", std::as_bytes(std::span(network)));
}

Prints

i 10097201832880355573875790863214833226896186369872326994250398570376877433686009543845316266007917815719968899072
native [59, cb, 10, 00, 3c, d7, e0, 15, 32, 49, 72, a9, 2e, b3, 77, ae, 89, f4, 08, 01, 00, 95, 30, d8, 20, 68, 31, 57, fe, 7a, 79, c9, de, 72, df, ec, a0, 10, 7a, 86, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 10, cb, 59, 15, e0, d7, 3c, a9, 72, 49, 32, ae, 77, b3, 2e, 01, 08, f4, 89, d8, 30, 95, 00, 57, 31, 68, 20, c9, 79, 7a, fe, ec, df, 72, de, 86, 7a, 10, a0, 00, 00, 00, 00, 00, 00, 00, 00]

Of course, loading is similar. Sadly, we have to teach Boost Multiprecision about big_uint32_t¹:

template <> struct mp::detail::make_unsigned<be::big_uint32_t> {
    using type = be::big_uint32_t;
};

But then it is just:

template <typename R = BigInt, typename T> R load(std::span<T> in)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    R number;
    mp::import_bits(number, in.begin(), in.end(), sizeof(T) * CHAR_BIT);
    return number;
}

Live Demo

Live On Compiler Explorer

#include <boost/endian/arithmetic.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <fmt/ranges.h>
#include <span>

namespace mp = boost::multiprecision;
namespace be = boost::endian;
using BigInt = mp::cpp_int;

template <> struct mp::detail::make_unsigned<be::big_uint32_t> {
    using type = be::big_uint32_t;
};

template <typename T, typename Out> Out save(BigInt const& number, Out out)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    return mp::export_bits(number, out, sizeof(T) * CHAR_BIT);
}

template <typename R = BigInt, typename T> R load(std::span<T> in)
{
    static_assert(std::is_trivial_v<T> and std::is_standard_layout_v<T>);
    R number;
    mp::import_bits(number, in.begin(), in.end(), sizeof(T) * CHAR_BIT);
    return number;
}

int main() {
    for (int exp = 1;  exp <= 69; ++exp) {
        BigInt i = pow(BigInt(42), exp);

        std::vector<uint32_t>                    native;
        std::vector<boost::endian::big_uint32_t> network;

        save<uint32_t>(i, back_inserter(native));
        save<boost::endian::big_uint32_t>(i, back_inserter(network));

        fmt::print("i {}\n", i.str());
        fmt::print("native {::02x}\n", std::as_bytes(std::span(native)));
        fmt::print("network {::02x}\n", std::as_bytes(std::span(network)));

        auto from_native  = load(std::span(native));
        auto from_network = load(std::span(network));
        fmt::print("from_native equal: {}\n", from_native == i);
        fmt::print("from_network equal: {}\n", from_network == i);
    }
}

Prints

i 42
native [2a, 00, 00, 00]
network [00, 00, 00, 2a]
from_native equal: true
from_network equal: true
i 1764
native [e4, 06, 00, 00]
network [00, 00, 06, e4]
from_native equal: true
from_network equal: true
i 74088
native [68, 21, 01, 00]
network [00, 01, 21, 68]
from_native equal: true
from_network equal: true
i 3111696
native [10, 7b, 2f, 00]
network [00, 2f, 7b, 10]
from_native equal: true
from_network equal: true
i 130691232
native [a0, 30, ca, 07]
network [07, ca, 30, a0]
from_native equal: true
from_network equal: true
i 5489031744
native [01, 00, 00, 00, 40, fa, 2b, 47]
network [00, 00, 00, 01, 47, 2b, fa, 40]
from_native equal: true
from_network equal: true
i 230539333248
native [35, 00, 00, 00, 80, 0e, 37, ad]
network [00, 00, 00, 35, ad, 37, 0e, 80]
from_native equal: true
from_network equal: true
i 9682651996416
native [ce, 08, 00, 00, 00, 61, 08, 6b]
network [00, 00, 08, ce, 6b, 08, 61, 00]
from_native equal: true
from_network equal: true
i 406671383849472
native [dd, 71, 01, 00, 00, ea, 5f, 8f]
network [00, 01, 71, dd, 8f, 5f, ea, 00]
from_native equal: true
from_network equal: true
i 17080198121677824
native [59, ae, 3c, 00, 00, 64, bc, 85]
network [00, 3c, ae, 59, 85, bc, 64, 00]
from_native equal: true
from_network equal: true
i 717368321110468608
native [af, 9a, f4, 09, 00, 68, e8, f0]
network [09, f4, 9a, af, f0, e8, 68, 00]
from_native equal: true
from_network equal: true
i 30129469486639681536
native [01, 00, 00, 00, dd, 60, 21, a2, 00, 10, 21, 86]
network [00, 00, 00, 01, a2, 21, 60, dd, 86, 21, 10, 00]
from_native equal: true
from_network equal: true
i 1265437718438866624512
native [44, 00, 00, 00, 58, e4, 79, 99, 00, a0, 6c, 01]
network [00, 00, 00, 44, 99, 79, e4, 58, 01, 6c, a0, 00]
from_native equal: true
from_network equal: true
i 53148384174432398229504
native [41, 0b, 00, 00, 70, 76, ff, 2d, 00, 40, d2, 3b]
network [00, 00, 0b, 41, 2d, ff, 76, 70, 3b, d2, 40, 00]
from_native equal: true
from_network equal: true
i 2232232135326160725639168
native [b1, d8, 01, 00, 69, 6e, e9, 8b, 00, 80, 7e, d0]
network [00, 01, d8, b1, 8b, e9, 6e, 69, d0, 7e, 80, 00]
from_native equal: true
from_network equal: true
i 93753749683698750476845056
native [20, 8d, 4d, 00, 5c, 1d, 4c, f4, 00, 00, c1, 34]
network [00, 4d, 8d, 20, f4, 4c, 1d, 5c, 34, c1, 00, 00]
from_native equal: true
from_network equal: true
i 3937657486715347520027492352
native [68, 27, b9, 0c, 20, d1, 7c, 14, 00, 00, aa, a7]
network [0c, b9, 27, 68, 14, 7c, d1, 20, a7, aa, 00, 00]
from_native equal: true
from_network equal: true
i 165381614442044595841154678784
native [02, 00, 00, 00, 13, 77, 60, 16, 5b, 4f, 7a, 5c, 00, 00, e4, 81]
network [00, 00, 00, 02, 16, 60, 77, 13, 5c, 7a, 4f, 5b, 81, e4, 00, 00]
from_native equal: true
from_network equal: true
i 6946027806565873025328496508928
native [57, 00, 00, 00, 2d, 89, d3, ab, 03, 05, 11, 2c, 00, 00, 68, 4f]
network [00, 00, 00, 57, ab, d3, 89, 2d, 2c, 11, 05, 03, 4f, 68, 00, 00]
from_native equal: true
from_network equal: true
i 291733167875766667063796853374976
native [62, 0e, 00, 00, 69, 81, b4, 30, 8b, d2, ca, 3a, 00, 00, 10, 07]
network [00, 00, 0e, 62, 30, b4, 81, 69, 3a, ca, d2, 8b, 07, 10, 00, 00]
from_native equal: true
from_network equal: true
i 12252793050782200016679467841748992
native [1b, 5c, 02, 00, 43, 3b, 9d, fd, cf, 8a, 46, a5, 00, 00, a0, 28]
network [00, 02, 5c, 1b, fd, 9d, 3b, 43, a5, 46, 8a, cf, 28, a0, 00, 00]
from_native equal: true
from_network equal: true
i 514617308132852400700537649353457664
native [97, 1c, 63, 00, 19, b9, cb, 9b, fc, c5, 92, 1d, 00, 00, 40, aa]
network [00, 63, 1c, 97, 9b, cb, b9, 19, 1d, 92, c5, fc, aa, 40, 00, 00]
from_native equal: true
from_network equal: true
i 21613926941579800829422581272845221888
native [df, b0, 42, 10, 1e, 5e, 6c, 8f, 73, 7b, 14, da, 00, 00, 80, ee]
network [10, 42, b0, df, 8f, 6c, 5e, 1e, da, 14, 7b, 73, ee, 80, 00, 00]
from_native equal: true
from_network equal: true
i 907784931546351634835748413459499319296
native [02, 00, 00, 00, ad, 04, f1, aa, 0f, 71, c7, 87, 05, 41, 5c, c7, 00, 00, 00, 21]
network [00, 00, 00, 02, aa, f1, 04, ad, 87, c7, 71, 0f, c7, 5c, 41, 05, 21, 00, 00, 00]
from_native equal: true
from_network equal: true
i 38126967124946768663101433365298971410432
native [70, 00, 00, 00, 78, c4, 8a, 0b, 96, 8c, b8, 46, d7, aa, 22, b5, 00, 00, 00, 6a]
network [00, 00, 00, 70, 0b, 8a, c4, 78, 46, b8, 8c, 96, b5, 22, aa, d7, 6a, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1601332619247764283850260201342556799238144
native [61, 12, 00, 00, bb, 3b, c4, e4, b9, 10, 47, 9a, 57, 07, b0, b7, 00, 00, 00, 64]
network [00, 00, 12, 61, e4, c4, 3b, bb, 9a, 47, 10, b9, b7, b0, 07, 57, 64, 00, 00, 00]
from_native equal: true
from_network equal: true
i 67255970008406099921710928456387385568002048
native [0f, 04, 03, 00, c7, cc, 31, 88, 78, be, a8, 4f, 56, 34, e1, 22, 00, 00, 00, 68]
network [00, 03, 04, 0f, 88, 31, cc, c7, 4f, a8, be, 78, 22, e1, 34, 56, 68, 00, 00, 00]
from_native equal: true
from_network equal: true
i 2824750740353056196711858995168270193856086016
native [8c, aa, 7e, 00, b3, 98, 2b, 58, b5, 3f, af, 11, 2d, 96, f2, b8, 00, 00, 00, 10]
network [00, 7e, aa, 8c, 58, 2b, 98, b3, 11, af, 3f, b5, b8, f2, 96, 2d, 10, 00, 00, 00]
from_native equal: true
from_network equal: true
i 118639531094828360261898077797067348141955612672
native [06, fb, c7, 14, 60, 0d, 27, 77, d0, 73, c0, e6, 64, a3, cc, 57, 00, 00, 00, a0]
network [14, c7, fb, 06, 77, 27, 0d, 60, e6, c0, 73, d0, 57, cc, a3, 64, a0, 00, 00, 00]
from_native equal: true
from_network equal: true
i 4982860305982791130999719267476828621962135732224
native [03, 00, 00, 00, 0f, 2f, cf, 68, e5, 31, 68, 8c, 2e, 00, 93, db, 82, ce, 92, 67, 00, 00, 00, 40]
network [00, 00, 00, 03, 68, cf, 2f, 0f, 8c, 68, 31, e5, db, 93, 00, 2e, 67, 92, ce, 82, 40, 00, 00, 00]
from_native equal: true
from_network equal: true
i 209280132851277227501988209234026802122409700753408
native [8f, 00, 00, 00, 8d, b8, fd, 31, b6, 2f, 18, 09, 9c, 07, 1e, 06, 5e, e1, 15, fe, 00, 00, 00, 80]
network [00, 00, 00, 8f, 31, fd, b8, 8d, 09, 18, 2f, b6, 06, 1e, 07, 9c, fe, 15, e1, 5e, 80, 00, 00, 00]
from_native equal: true
from_network equal: true
i 8789765579753643555083504787829125689141207431643136
native [7e, 17, 00, 00, 23, 47, a0, 33, dd, d3, f7, 7d, c1, 3f, ed, 00, 81, f9, 96, af, 00, 00, 00, 00]
network [00, 00, 17, 7e, 33, a0, 47, 23, 7d, f7, d3, dd, 00, ed, 3f, c1, af, 96, f9, 81, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 369170154349653029313507201088823278943930712129011712
native [b4, da, 03, 00, d2, ab, 4b, 78, 42, c2, a8, aa, c6, 75, ec, 26, 2a, ef, c4, ce, 00, 00, 00, 00]
network [00, 03, da, b4, 78, 4b, ab, d2, aa, a8, c2, 42, 26, ec, 75, c6, ce, c4, ef, 2a, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 15505146482685427231167302445730577715645089909418491904
native [9b, e1, a1, 00, 8f, 30, 6a, bc, da, de, af, ff, 9d, 52, cb, 62, e4, 3c, 4f, ec, 00, 00, 00, 00]
network [00, a1, e1, 9b, bc, 6a, 30, 8f, ff, af, de, da, 62, cb, 52, 9d, ec, 4f, 3c, e4, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 651216152272787943709026702720684264057093776195576659968
native [8c, 03, 8f, 1a, 9f, f7, 6b, e9, d4, 8f, da, f2, e8, 8d, 5b, 35, 68, fd, ff, c4, 00, 00, 00, 00]
network [1a, 8f, 03, 8c, e9, 6b, f7, 9f, f2, da, 8f, d4, 35, 5b, 8d, e8, c4, ff, fd, 68, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 27351078395457093635779121514268739090397938600214219718656
native [04, 00, 00, 00, 1e, 95, 76, 5b, 3d, a0, b6, 4b, d0, 98, db, d7, 30, 48, 05, c1, 10, 93, ff, 51, 00, 00, 00, 00]
network [00, 00, 00, 04, 5b, 76, 95, 1e, 4b, b6, a0, 3d, d7, db, 98, d0, c1, 05, 48, 30, 51, ff, 93, 10, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1148745292609197932702723103599287041796713421208997228183552
native [b7, 00, 00, 00, f8, 76, 74, 01, 25, 4a, f6, 6b, 3f, 12, 07, 6a, ed, d7, dd, aa, a0, 20, ee, 73, 00, 00, 00, 00]
network [00, 00, 00, b7, 01, 74, 76, f8, 6b, f6, 4a, 25, 6a, 07, 12, 3f, aa, dd, d7, ed, 73, ee, 20, a0, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 48247302289586313173514370351170055755461963690777883583709184
native [06, 1e, 00, 00, c1, 84, 1b, 3d, 23, 2a, 68, b6, 72, fe, 28, 65, f5, 6c, 65, 08, 40, 5a, 11, 05, 00, 00, 00, 00]
network [00, 00, 1e, 06, 3d, 1b, 84, c1, b6, 68, 2a, 23, 65, 28, fe, 72, 08, 65, 6c, f5, 05, 11, 5a, 40, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 2026386696162625153287603554749142341729402475012671110515785728
native [06, ed, 04, 00, c7, c7, 83, 06, ce, e9, 16, ed, b5, be, b9, 98, 32, e0, a3, 60, 80, ce, d8, d4, 00, 00, 00, 00]
network [00, 04, ed, 06, 06, 83, c7, c7, ed, 16, e9, ce, 98, b9, be, b5, 60, a3, e0, 32, d4, d8, ce, 80, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 85108241238830256438079349299463978352634903950532186641663000576
native [fd, e2, ce, 00, cc, c6, 9e, 11, e5, 5b, c2, e5, c1, 49, 79, 0e, 56, c8, e2, da, 00, e1, 91, eb, 00, 00, 00, 00]
network [00, ce, e2, fd, 11, 9e, c6, cc, e5, c2, 5b, e5, 0e, 79, 49, c1, da, e2, c8, 56, eb, 91, e1, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 3574546132030870770399332670577487090810665965922351838949846024192
native [84, 3d, f1, 21, 9d, 9d, 0c, e4, 94, 13, e3, b1, cd, 19, e6, 5f, 42, de, 34, e9, 00, ea, ee, a5, 00, 00, 00, 00]
network [21, f1, 3d, 84, e4, 0c, 9d, 9d, b1, e3, 13, 94, 5f, e6, 19, cd, e9, 34, de, 42, a5, ee, ea, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 150130937545296572356771972164254457814047970568738777235893533016064
native [05, 00, 00, 00, cd, 17, 94, 91, df, db, 11, 6a, 57, 36, 41, 2f, c8, 3b, c0, bb, ef, 76, ac, 42, 00, 64, 32, 39, 00, 00, 00, 00]
network [00, 00, 00, 05, 91, 94, 17, cd, 6a, 11, db, df, 2f, 41, 36, 57, bb, c0, 3b, c8, 42, ac, 76, ef, 39, 32, 64, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 6305499376902456038984422830898687228190014763887028643907528386674688
native [e9, 00, 00, 00, b3, e7, 4b, e2, 9d, 12, ee, 66, 64, ea, b2, c0, da, ce, 89, cd, 3f, 83, 4b, f0, 00, 68, 44, 62, 00, 00, 00, 00]
network [00, 00, 00, e9, e2, 4b, e7, b3, 66, ee, 12, 9d, c0, b2, ea, 64, cd, 89, ce, da, f0, 4b, 83, 3f, 62, 44, 68, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 264830973829903153637345758897744863583980620083255203044116192240336896
native [5f, 26, 00, 00, 6e, 03, 74, 20, e1, 0d, 0f, e3, 89, 74, 5a, 9d, eb, ef, 9b, b8, 66, 88, 63, 6c, 00, 10, 39, 1f, 00, 00, 00, 00]
network [00, 00, 26, 5f, 20, 74, 03, 6e, e3, 0f, 0d, e1, 9d, 5a, 74, 89, b8, 9b, ef, eb, 6c, 63, 88, 66, 1f, 39, 10, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 11122900900855932452768521873705284270527186043496718527852880074094149632
native [9b, 4b, 06, 00, 31, 90, 08, 53, 03, 47, 78, 40, 98, 1e, d7, d0, 9f, 5c, 95, 49, c1, 60, 54, c8, 00, a0, 5c, 1f, 00, 00, 00, 00]
network [00, 06, 4b, 9b, 53, 08, 90, 31, 40, 78, 47, 03, d0, d7, 1e, 98, 49, 95, 5c, 9f, c8, 54, 60, c1, 1f, 5c, a0, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 467161837835949163016277918695621939362141813826862178169820963111954284544
native [7b, 67, 08, 01, 14, a8, 67, 9f, a0, a6, bb, 93, fc, 04, 4b, 43, 36, 32, 81, 12, af, df, d7, dd, 00, 40, 32, 25, 00, 00, 00, 00]
network [01, 08, 67, 7b, 9f, 67, a8, 14, 93, bb, a6, a0, 43, 4b, 04, fc, 12, 81, 32, 36, dd, d7, df, af, 25, 32, 40, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 19620797189109864846683672585216121453209956180728211483132480450702079950848
native [48, fa, 60, 2b, 60, 93, 01, 27, 4b, 56, c9, 3c, 5b, d1, 4e, 0a, 00, 3d, 32, 09, bc, b2, 6a, 65, 00, 80, 3e, 1a, 00, 00, 00, 00]
network [2b, 60, fa, 48, 27, 01, 93, 60, 3c, c9, 56, 4b, 0a, 4e, d1, 5b, 09, 32, 3d, 00, 65, 6a, b2, bc, 1a, 3e, 80, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 824073481942614323560714248579077101034818159590584882291564178929487357935616
native [07, 00, 00, 00, d6, 0f, e9, 1d, c9, 2d, 42, 66, 4f, 28, 08, f9, ef, 58, ee, b0, 10, 02, 3e, 82, dc, 52, 81, a3, 00, 00, 41, 4e, 00, 00, 00, 00]
network [00, 00, 00, 07, 1d, e9, 0f, d6, 66, 42, 2d, c9, f9, 08, 28, 4f, b0, ee, 58, ef, 82, 3e, 02, 10, a3, 81, 52, dc, 4e, 41, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 34611086241589801589549998440321238243462362702804565056245695515038469033295872
native [2a, 01, 00, 00, 2c, 99, 3c, e8, 22, 83, db, c6, 13, 9d, 56, db, 4b, 97, 1a, 07, ba, 56, 2c, 5e, 24, 98, 37, d3, 00, 00, aa, d6, 00, 00, 00, 00]
network [00, 00, 01, 2a, e8, 3c, 99, 2c, c6, db, 83, 22, db, 56, 9d, 13, 07, 1a, 97, 4b, 5e, 2c, 56, ba, d3, 37, 98, 24, d6, aa, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1453665622146771666761099934493492006225419233517791732362319211631615699398426624
native [0a, 31, 00, 00, 58, 21, f1, 19, b7, 83, 03, a0, 1f, c5, 35, fc, 5d, d2, 5c, 2a, a6, 3a, 46, 73, 0b, f6, 1e, a7, 00, 00, e4, 37, 00, 00, 00, 00]
network [00, 00, 31, 0a, 19, f1, 21, 58, a0, 03, 83, b7, fc, 35, c5, 1f, 2a, 5c, d2, 5d, 73, 46, 3a, a6, a7, 1e, f6, 0b, 37, e4, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 61053956130164410003966197248726664261467607807747252759217406888527859374733918208
native [a8, 0b, 08, 00, 8a, 78, 8f, 41, 2f, 9c, 93, 40, 1c, 57, d2, 60, 54, 83, 3a, f3, 57, 9f, 85, e9, d7, 5d, 14, 6b, 00, 00, 68, 2b, 00, 00, 00, 00]
network [00, 08, 0b, a8, 41, 8f, 78, 8a, 40, 93, 9c, 2f, 60, d2, 57, 1c, f3, 3a, 83, 54, e9, 85, 9f, 57, 6b, 14, 5d, d7, 2b, 68, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 2564266157466905220166580284446519898981639527925384615887131089318170093738824564736
native [9a, e9, 51, 01, ae, c6, 89, c1, c5, 9f, 37, 98, bf, 4a, 82, e2, ee, 8b, 99, e7, 57, 24, ec, 4f, 4d, 65, 57, 91, 00, 00, 10, 1f, 00, 00, 00, 00]
network [01, 51, e9, 9a, c1, 89, c6, ae, 98, 37, 9f, c5, e2, 82, 4a, bf, e7, 99, 8b, ee, 4f, ec, 24, 57, 91, 57, 65, 4d, 1f, 10, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 107699178613610019246996371946753835757228860172866153867259505751363143937030631718912
native [63, 53, 70, 37, a4, 98, 9a, c0, 77, 36, 20, f9, 7b, 43, 60, 29, 19, f5, 30, ff, 5d, f6, bd, 1c, a7, 9e, 56, d8, 00, 00, a0, 18, 00, 00, 00, 00]
network [37, 70, 53, 63, c0, 9a, 98, a4, f9, 20, 36, 77, 29, 60, 43, 7b, ff, 30, f5, 19, 1c, bd, f6, 5d, d8, 56, 9e, a7, 18, a0, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 4523365501771620808373847621763661101803612127260378462424899241557252045355286532194304
native [09, 00, 00, 00, 5d, ae, 6d, 18, 10, 0b, 5d, 99, 8c, ef, 48, df, 57, 12, cb, c9, 1e, 36, 08, de, 65, 6b, 2a, b7, 6a, 07, 36, 7e, 00, 00, 40, 0a, 00, 00, 00, 00]
network [00, 00, 00, 09, 18, 6d, ae, 5d, 99, 5d, 0b, 10, df, 48, ef, 8c, c9, cb, 12, 57, de, 08, 36, 1e, b7, 2a, 6b, 65, 7e, 36, 07, 6a, 0a, 40, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 189981351074408073951701600114073766275751709344935895421845768145404585904922034352160768
native [7e, 01, 00, 00, 5b, 9b, fe, 01, c4, d0, 43, 29, 19, 4d, f7, a1, 6a, 02, 51, 1b, 0a, e1, 58, 6d, a6, 9e, f5, 0c, 65, 37, dd, b4, 00, 00, 80, ae, 00, 00, 00, 00]
network [00, 00, 01, 7e, 01, fe, 9b, 5b, 29, 43, d0, c4, a1, f7, 4d, 19, 1b, 51, 02, 6a, 6d, 58, e1, 0a, 0c, f5, 9e, a6, b4, dd, 37, 65, ae, 80, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 7979216745125139105971467204791098183581571792487307607717522262106992608006725442790752256
native [ac, 3e, 00, 00, f4, 7c, c5, 53, 42, 40, 20, c5, 1e, a6, 92, 92, 75, 65, 4a, 7b, a6, eb, 94, f0, 59, 07, 4c, 20, ae, 16, 4b, ac, 00, 00, 00, a1, 00, 00, 00, 00]
network [00, 00, 3e, ac, 53, c5, 7c, f4, c5, 20, 40, 42, 92, 92, a6, 1e, 7b, 4a, 65, 75, f0, 94, eb, a6, 20, 4c, 07, 59, ac, 4b, 16, ae, a1, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 335127103295255842450801622601226123710426015284466919524135935008493689536282468597211594752
native [45, 48, 0a, 00, 28, 80, 66, be, ec, 8a, 4a, 57, 00, 41, 0f, 0c, 59, a5, 34, 3a, 41, a9, 6e, 78, b6, 34, 79, 4c, a6, b8, 51, 44, 00, 00, 00, 6a, 00, 00, 00, 00]
network [00, 0a, 48, 45, be, 66, 80, 28, 57, 4a, 8a, ec, 0c, 0f, 41, 00, 3a, 34, a5, 59, 78, 6e, a9, 41, 4c, 79, 34, b6, 44, 51, b8, a6, 6a, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 14075338338400745382933668149251497195837892641947610620013709270356734960523863681082886979584
native [71, db, af, 01, 9e, 06, d1, 3c, b9, ca, 3a, 52, 09, aa, 80, fa, ad, 20, a3, 8c, b6, c4, 27, c2, e7, a5, e2, 8b, 4d, 4b, 68, 35, 00, 00, 00, 64, 00, 00, 00, 00]
network [01, af, db, 71, 3c, d1, 06, 9e, 52, 3a, ca, b9, fa, 80, aa, 09, 8c, a3, 20, ad, c2, 27, c4, b6, 8b, e2, a5, e7, 35, 68, 4b, 4d, 64, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 591164210212831306083214062268562882225191490961799646040575789354982868342002274605481253142528
native [93, 00, da, 46, f9, 15, 4b, fa, 83, 42, a5, 7d, 91, e5, 1b, 19, 81, 5c, c3, 12, f2, 45, 86, da, ee, 37, 2f, f3, b2, 5a, 1c, c3, 00, 00, 00, 68, 00, 00, 00, 00]
network [46, da, 00, 93, fa, 4b, 15, f9, 7d, a5, 42, 83, 19, 1b, e5, 91, 12, c3, 5c, 81, da, 86, 45, f2, f3, 2f, 37, ee, c3, 1c, 5a, b2, 68, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 24828896828938914855494990615279641053458042620395585133704183152909280470364095533430212631986176
native [0b, 00, 00, 00, 47, 18, c4, 9f, ee, 9a, 51, 10, 82, e9, 1c, 9d, cd, a9, 93, 1e, 4d, 2d, 0d, 14, db, 79, 07, da, 2c, 2d, bf, e5, 45, e1, a6, 02, 00, 00, 00, 10, 00, 00, 00, 00]
network [00, 00, 00, 0b, 9f, c4, 18, 47, 10, 51, 9a, ee, 9d, 1c, e9, 82, 1e, 93, a9, cd, 14, 0d, 2d, 4d, da, 07, 79, db, e5, bf, 2d, 2c, 02, a6, e1, 45, 10, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1042813666815434423930789605841744924245237790056614575615575692422189779755292012404068930543419392
native [e8, 01, 00, 00, a8, fb, 2b, 36, 25, 6b, 63, ad, 59, 4f, be, c6, a5, db, 39, 04, c5, 6e, 29, 4a, 13, fe, 39, c5, 38, 69, 5d, b1, 54, f5, 60, 6f, 00, 00, 00, a0, 00, 00, 00, 00]
network [00, 00, 01, e8, 36, 2b, fb, a8, ad, 63, 6b, 25, c6, be, 4f, 59, 04, 39, db, a5, 4a, 29, 6e, c5, c5, 39, fe, 13, b1, 5d, 69, 38, 6f, 60, f5, 54, a0, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 43798174006248245805093163445353286818299987182377812175854179081731970749722264520970895082823614464
native [18, 50, 00, 00, ac, 49, 37, e3, 32, 94, 4f, 72, 9a, 04, 39, 9b, 1e, 09, 7e, b1, 72, 2c, cc, 2a, 3b, af, 83, 5b, 42, 43, 53, 19, e2, 3f, e8, 45, 00, 00, 00, 40, 00, 00, 00, 00]
network [00, 00, 50, 18, e3, 37, 49, ac, 72, 4f, 94, 32, 9b, 39, 04, 9a, b1, 7e, 09, 1e, 2a, cc, 2c, 72, 5b, 83, af, 3b, 19, 53, 43, 42, 45, e8, 3f, e2, 40, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 1839523308262426323813912864704838046368599461659868111385875521432742771488335109880777593478591807488
native [15, 24, 0d, 00, 4a, 16, 12, 47, 4d, 50, 0e, c1, 61, c1, 5a, 77, f3, 7e, ad, 1e, c3, 4a, 7f, 05, b2, bf, 9a, 03, df, 08, a9, 27, 1e, 7b, 1a, 78, 00, 00, 00, 80, 00, 00, 00, 00]
network [00, 0d, 24, 15, 47, 12, 16, 4a, c1, 0e, 50, 4d, 77, 5a, c1, 61, 1e, ad, 7e, f3, 05, 7f, 4a, c3, 03, 9a, bf, b2, 27, a9, 08, df, 78, 1a, 7b, 1e, 80, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 77259978947021905600184340317603197947481177389714460678206771900175196402510074614992658926100855914496
native [7d, eb, 27, 02, 43, a8, f7, a8, b5, 2c, 59, ac, ef, b9, e3, 94, de, d3, 76, 08, fe, 43, e2, e6, 3a, 73, 63, 97, a9, 74, bb, 81, 01, 33, 58, b4, 00, 00, 00, 00, 00, 00, 00, 00]
network [02, 27, eb, 7d, a8, f7, a8, 43, ac, 59, 2c, b5, 94, e3, b9, ef, 08, 76, d3, de, e6, e2, 43, fe, 97, 63, 73, 3a, 81, bb, 74, a9, b4, 58, 33, 01, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 3244919115774920035207742293339334313794209450368007348484684419807358248905423133829691674896235948408832
native [9d, a2, 8c, 5a, 1a, 9b, a1, b8, ca, 55, a1, 46, 37, 81, 5c, 6d, 91, c2, 7e, 63, c4, 27, 1f, e1, 99, e7, 50, d6, d7, 23, c1, 48, 2a, 5e, 78, 96, 00, 00, 00, 00, 00, 00, 00, 00]
network [5a, 8c, a2, 9d, b8, a1, 9b, 1a, 46, a1, 55, ca, 6d, 5c, 81, 37, 63, 7e, c2, 91, e1, 1f, 27, c4, d6, 50, e7, 99, 48, c1, 23, d7, 96, 78, 5e, 2a, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 136286602862546641478725176320252041179356796915456308636356745631909046454027771620847050345641909833170944
native [0e, 00, 00, 00, e0, ad, 12, db, 4f, 72, 83, 4a, 35, 13, 78, 96, 16, 33, 2d, f1, ee, eb, cb, 52, 4b, 86, 1c, ef, 25, ff, 45, 29, 5e, e1, af, ef, e4, 72, bf, af, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 00, 00, 0e, db, 12, ad, e0, 4a, 83, 72, 4f, 96, 78, 13, 35, f1, 2d, 33, 16, 52, cb, eb, ee, ef, 1c, 86, 4b, 29, 45, ff, 25, ef, af, e1, 5e, af, bf, 72, e4, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 5724037320226958942106457405450585729532985470449164962726983316540179951069166408075576114516960212993179648
native [6f, 02, 00, 00, cc, 86, 10, f1, 0e, c1, 90, 39, d9, 26, b3, af, a9, 61, 6a, 91, 33, b5, 74, 95, 54, 08, ae, 3a, 39, dc, 7b, c5, 88, f9, da, 52, 68, d9, 68, d5, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 00, 02, 6f, f1, 10, 86, cc, 39, 90, c1, 0e, af, b3, 26, d9, 91, 6a, 61, a9, 95, 74, b5, 33, 3a, ae, 08, 54, c5, 7b, dc, 39, 52, da, f9, 88, d5, 68, d9, 68, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 240409567449532275568471211028924600640385389758864928434533299294687557944904989139174196809712328945713545216
native [5d, 66, 00, 00, 81, 1d, b6, 8c, 68, ac, bf, 71, b1, 5f, 64, d3, d2, 05, 74, db, 67, ba, 25, 85, e8, 5d, 8d, a0, 67, 21, 52, 66, 73, f0, ec, 97, 10, ab, 33, 03, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 00, 66, 5d, 8c, b6, 1d, 81, 71, bf, ac, 68, d3, 64, 5f, b1, db, 74, 05, d2, 85, 25, ba, 67, a0, 8d, 5d, e8, 66, 52, 21, 67, 97, ec, f0, 73, 03, 33, ab, 10, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true
i 10097201832880355573875790863214833226896186369872326994250398570376877433686009543845316266007917815719968899072
native [59, cb, 10, 00, 3c, d7, e0, 15, 32, 49, 72, a9, 2e, b3, 77, ae, 89, f4, 08, 01, 00, 95, 30, d8, 20, 68, 31, 57, fe, 7a, 79, c9, de, 72, df, ec, a0, 10, 7a, 86, 00, 00, 00, 00, 00, 00, 00, 00]
network [00, 10, cb, 59, 15, e0, d7, 3c, a9, 72, 49, 32, ae, 77, b3, 2e, 01, 08, f4, 89, d8, 30, 95, 00, 57, 31, 68, 20, c9, 79, 7a, fe, ec, df, 72, de, 86, 7a, 10, a0, 00, 00, 00, 00, 00, 00, 00, 00]
from_native equal: true
from_network equal: true

¹ beware: do NOT specialize std::make_unsigned: "The behavior of a program that adds specializations for make_unsigned is undefined"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文