Skip to main content

C++ port of the C# BigInteger class

Project description

BigIntegerCpp

CircleCI

A C++ port of the C# BigInteger class, with bindings for Python.

Building

The default configuration builds a shared library

mkdir build
cd build
cmake ..
cmake --build .

Build options

You can define various options during the configure stage to control the output

Var Default Comment
BIGINTEGER_BUILD_SHARED_LIB ON
BIGINTEGER_BUILD_STATIC_LIB OFF
BIGINTEGER_BUILD_TESTING OFF

Building the bindings

Read here.

Running the tests

Test can be ran as follows

cmake -D BUILD_TESTING=ON ..
cmake --build .
./tests/unit_tests

The output should be similar to

...

[ RUN      ] properties.RunMinusOneTests
[       OK ] properties.RunMinusOneTests (2 ms)
[----------] 3 tests from properties (7 ms total)
[----------] Global test environment tear-down
[==========] 117 tests from 22 test suites ran. (17481 ms total)
[  PASSED  ] 117 tests.

Including in your CMake project

The project can be included in 2 ways

add_subdirectory(BigIntegerCpp)

or if it has been installed via make install you can use

find_library(bigintegercpp)

It is possible to build both a SHARED and STATIC library simultaneously, as such 2 link targets exists to differentiate between them, respectively

BigIntegerCpp::BigIntegerCpp
BigIntegerCpp::BigIntegerCpp-static

To use in your target add

target_include_directories(your_target PUBLIC ${bigintegercpp_INCLUDE_DIRS})
target_link_libraries(your_target PRIVATE BigIntegerCpp::BigIntegerCpp)

Source.cpp

#include <bigintegercpp/BigInteger.h>

FAQ

  1. Why this project?

    It is purpose build for use in relationship to the NEO blockchain project. In order to create a compliant port of their virtual machine a need for a compliant BigInteger implementation exists. Any difference, in for example the modulo implementation, can result in VM execution deviation. This is just one of the many problems we've encountered after attemping to wrap Python's native int to produce identical behaviour.

  2. Should I use this project?

    If you have to ask this question, then no.

  3. How fast is it?

    We don't know. The focus has been on conformity to the C# BigInteger class, not on speed. If you want speed you might want to look at https://gmplib.org/

  4. Are there any known behavioural deviations from the C# implementation?

    The only known deviations are in the string parsing and conversion to string methods. Specifically, the overloads with IFormatProvider are not supported. Only base10 parsing is supported. String input may be prepended with + or -. Any whitespace is considered the end of the input.

    Deviations in any other parts are considered bugs. Please report them.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pybiginteger-1.3.3-cp312-cp312-win_amd64.whl (124.3 kB view details)

Uploaded CPython 3.12 Windows x86-64

pybiginteger-1.3.3-cp312-cp312-musllinux_1_1_x86_64.whl (677.6 kB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

pybiginteger-1.3.3-cp312-cp312-musllinux_1_1_aarch64.whl (653.8 kB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

pybiginteger-1.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (154.8 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pybiginteger-1.3.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (138.8 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

pybiginteger-1.3.3-cp312-cp312-macosx_11_0_arm64.whl (119.9 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pybiginteger-1.3.3-cp312-cp312-macosx_10_9_x86_64.whl (133.9 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pybiginteger-1.3.3-cp311-cp311-win_amd64.whl (123.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

pybiginteger-1.3.3-cp311-cp311-musllinux_1_1_x86_64.whl (676.5 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pybiginteger-1.3.3-cp311-cp311-musllinux_1_1_aarch64.whl (654.6 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

pybiginteger-1.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (153.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pybiginteger-1.3.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (138.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

pybiginteger-1.3.3-cp311-cp311-macosx_11_0_arm64.whl (117.9 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pybiginteger-1.3.3-cp311-cp311-macosx_10_9_x86_64.whl (130.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 44b31296ac414f4b2ae6578ad12d069cec13325932557fe87cd8c3b57e96f970
MD5 0b0a8b1e0511a40f8da55d23caa83a6a
BLAKE2b-256 95304edab5f64a5b9cd1e210ad99495ccaeddffbe04254f3d18f6efc91aef185

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 cf882634e8404dcca576d69fd760aae7b5dd97c1d05bd4f3f454636beb422531
MD5 d273d85573e3ac8e52ba92f45922c87e
BLAKE2b-256 d058a28ae2ea1e05613a118e595326a1d7bb460667040deac0301977ce12a26c

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 c7d7bc040b705085a71043d807a5dfc6baa3243ae898dd83c253d4b05c5c8691
MD5 c7097f3ac82e1002d4e7676c9ccfc54c
BLAKE2b-256 1973ed36fbd077e60e1e0e0e46b4d42ba5a09e1f698fdba669e61797d0342fb8

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a5a40da7ce4593e647707dbe419e1bb1f38d841b4bde462363779f262bf581d
MD5 057a7fd4ca24d11475226db609f3f134
BLAKE2b-256 200f7f9490a577ebca2ee947700bcb85b5d82f8aa38621b65be7be702880caa0

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0a00e042fbb11955aaaf23063e7769fb653b7e772318f4cf57e1bc49fd65ee6a
MD5 0cfd177ed498e2f893c10ae04ca11938
BLAKE2b-256 5a86cf4b5eb44028781711aaa5755816ad5b78d78925072cc262e2bd6bc2ceae

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fa312748f85a3f4728e2bbc954832074be949cb17b4493573f160f271142de5
MD5 21dedf0cb407c9bcd1544c70ac703ebd
BLAKE2b-256 a13bbae5a88eff3e31de2f71bb170129ecd7f2a58b42d5705de2f731913cf386

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 73203f1d38a14183cdde95afa9f48389888e0ed6b39385618696a70ea5a0e680
MD5 ff177bbabb0cc3416e02181803c78593
BLAKE2b-256 0aa93b2008bb0fa52f3ddaa5590fe38bd17db7ae26702713c78a14ff3cbfb75f

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 51333cffa514a601395a6269557532e70d8e60517c04ead6ee809984a8f6b24b
MD5 67ab83f7d8f6ab2bd19d482dbe9d7833
BLAKE2b-256 688bf0bbbf584bb55ddf74942724cddfe69a4c674a77c0e66040405150d40fec

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ae4f179701698cb5db29a71b766aa07209c218a0386146a7c9fc200c919146c1
MD5 424ed3e3b638b382ffd05ca244e4ed7e
BLAKE2b-256 ba203171b331f2208f0f098ec5a8826f58f53244fb1635acdb0c695655cadd56

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 3490f37ba3a29a1f4ee65e5fceb50b1742d1c48289c7a6e1709d4fee27d92faa
MD5 56faed7129ae257d3aeea17ddb00497b
BLAKE2b-256 5274011e25ddaf660eb575978efed1f864d2220717dbff13a075c322c2373c62

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5baf4675e52ede678eb6039a7acd53e0ec29e7eb7429f1c0f0001fbcb0bacdf
MD5 0504254f0e34565fca27bf638c40976c
BLAKE2b-256 e65a418b05f6e948b4986de5e08dcced8ff807e11fa9caa1c51071ca597e11d3

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d24efc9ba48a05b23eea15f65da03942c98120e0a8ba6dce75a0b7c552d80d07
MD5 0a2ecdd066ffdeab43e1cc62f851e359
BLAKE2b-256 3f205b3b7a25601957e8a01b76c30412fa3d85ae0bd0bfb0054d2f4e5ee903c6

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 763f0b05ded1f067dcc3e7afa68c2ae348ba26323db45197747d8505bde1a924
MD5 0031755d0b59c0b9bf7b6b08546809f4
BLAKE2b-256 924cbdea60a50f49b3e8bcfda51635bcd67f659de5dcdb877252b6e6d3568a61

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.3-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 932d9440fc2254e90491e742d93a4fcbd2da15efbdf09b1e1a94703b1e58dc53
MD5 aa5ac7a388a87468ef3282f55ec6bdfd
BLAKE2b-256 b23c0e7a150bf2f87a7b99a96092d4f3766b730b9b1413692d89408cc3813b37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page