2019-01-15 12:15:49 +01:00
# num-bigint-dig
2014-09-23 16:27:05 -04:00
2018-11-24 12:04:44 +01:00
[](https://crates.io/crates/num-bigint-dig)
[](https://docs.rs/num-bigint-dig)
2019-01-15 12:16:32 +01:00

2019-01-15 12:15:49 +01:00
[](https://travis-ci.org/dignifiedquire/num-bigint)
2017-07-25 00:16:07 +02:00
2017-12-17 15:44:53 -08:00
Big integer types for Rust, `BigInt` and `BigUint` .
2014-12-23 09:54:56 -08:00
2019-01-15 15:24:40 +01:00
> **Warning** This is a fork of [`rust-num/num-bigint`](https://github.com/rust-num/num-bigint) with a focus on providing functionality, needed to implement cryptographic operations.
2018-11-24 12:04:44 +01:00
2014-09-23 16:27:05 -04:00
## Usage
Add this to your `Cargo.toml` :
```toml
2014-11-20 15:07:56 -05:00
[dependencies]
2018-11-24 12:04:44 +01:00
num-bigint-dig = "0.2"
2014-09-23 16:27:05 -04:00
```
and this to your crate root:
```rust
2018-11-24 12:04:44 +01:00
extern crate num_bigint_dig as num_bigint;
2014-09-23 16:27:05 -04:00
```
2017-02-09 16:09:48 -08:00
2018-05-15 18:01:14 -07:00
## Features
2018-05-16 13:59:29 -07:00
The `std` crate feature is mandatory and enabled by default. If you depend on
`num-bigint` with `default-features = false` , you must manually enable the
`std` feature yourself. In the future, we hope to support `#![no_std]` with
the `alloc` crate when `std` is not enabled.
2018-05-15 18:01:14 -07:00
Implementations for `i128` and `u128` are only available with Rust 1.26 and
later. The build script automatically detects this, but you can make it
mandatory by enabling the `i128` crate feature.
2019-01-15 17:02:12 +03:00
The `prime` feature gate enables algorithms and support for dealing with large primes.
2018-02-07 22:42:51 -08:00
## Releases
Release notes are available in [RELEASES.md ](RELEASES.md ).
2017-02-09 16:09:48 -08:00
## Compatibility
2018-05-14 13:39:35 -07:00
The `num-bigint` crate is tested for rustc 1.15 and greater.
2018-02-09 12:43:30 -08:00
## Alternatives
While `num-bigint` strives for good performance in pure Rust code, other
crates may offer better performance with different trade-offs. The following
table offers a brief comparison to a few alternatives.
| Crate | License | Min rustc | Implementation |
| :--------------- | :------------- | :-------- | :------------- |
2018-05-14 13:39:35 -07:00
| ** `num-bigint` ** | MIT/Apache-2.0 | 1.15 | pure rust |
2018-02-09 12:43:30 -08:00
| [`ramp` ] | Apache-2.0 | nightly | rust and inline assembly |
2018-02-09 14:05:34 -08:00
| [`rug` ] | LGPL-3.0+ | 1.18 | bundles [GMP] via [`gmp-mpfr-sys` ] |
| [`rust-gmp` ] | MIT | stable? | links to [GMP] |
2018-09-23 14:30:16 +02:00
| [`apint` ] | MIT/Apache-2.0 | 1.26 | pure rust (unfinished) |
2018-02-09 12:43:30 -08:00
[GMP]: https://gmplib.org/
[`gmp-mpfr-sys` ]: https://crates.io/crates/gmp-mpfr-sys
[`rug` ]: https://crates.io/crates/rug
[`rust-gmp` ]: https://crates.io/crates/rust-gmp
[`ramp` ]: https://crates.io/crates/ramp
2018-02-15 14:56:33 +01:00
[`apint` ]: https://crates.io/crates/apint
2019-01-15 17:02:12 +03:00
## Benchmarks
```
cargo bench --features prime
```