num-bigint

Arbitrary-precision BigInt and BigUint types for Rust

Library
Cargo
v0.4.8
612 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
74 /100 Good
Development Activity 80
Maintenance 52
Community 76
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 80
Code Quality 85
Innovation 55
Learning Curve 80

num-bigint provides BigInt and BigUint, arbitrary-precision signed and unsigned integer types for Rust, implementing the standard arithmetic, bitwise, and comparison operator traits so they behave like Rust’s built-in integer types but without a fixed bit width. It’s part of the rust-num family of crates, integrating with num-traits/num-integer for shared numeric trait implementations, and optionally supports serde serialization, rand (multiple versions) for random big-integer generation, and no_std + alloc environments.

What You Get

  • BigUint and BigInt types with full arithmetic, bitwise, and comparison operator trait implementations
  • Conversions to/from Rust’s built-in integer types, strings (multiple radixes), and byte slices
  • Modular exponentiation, root extraction, and other numeric algorithms exposed as trait methods
  • Optional rand_0_9/rand_0_10 feature flags for generating cryptographically-relevant random big integers
  • Optional serde serialization and no_std+alloc support for constrained environments

Common Use Cases

  • Cryptographic primitives and protocol implementations requiring modular exponentiation over large integers (RSA, Diffie-Hellman)
  • Arbitrary-precision arithmetic for financial, scientific, or combinatorics calculations that exceed 64/128-bit integer ranges
  • Blockchain and distributed-ledger implementations that manipulate large numeric identifiers or balances
  • Porting algorithms from languages with native bignum support (Python, JavaScript BigInt) into Rust without losing precision

Under The Hood

Architecture: the crate stores BigUint as a Vec of BigDigits (big_digit.rs) in a little-endian, base-2^32/2^64 representation, with biguint.rs implementing the unsigned arithmetic and bigint.rs layering a sign onto BigUint to implement signed BigInt, while bigrand.rs and macros.rs provide random-generation support and shared trait-impl macros respectively. Tech Stack: pure Rust (edition 2021, minimum supported Rust version 1.60), depending on the sibling num-integer and num-traits crates from the same rust-num organization for shared numeric trait definitions, with optional dependencies gated behind Cargo features (serde, rand_0_9, rand_0_10, quickcheck, arbitrary) so consumers only pull in what they use. Code Quality: the tests/ directory includes dedicated suites for signed/unsigned arithmetic, scalar operations, bitwise operations, modular exponentiation, root extraction, and a fuzzed.rs suite specifically covering fuzzer-discovered edge cases, reflecting the correctness bar expected of a widely-depended-on numeric primitive (nearly half a billion cumulative downloads per crates.io). API Design: BigUint/BigInt implement the same standard operator traits (Add, Sub, Mul, Shl, etc.) as Rust’s native integers, so idiomatic code (a + b, a.pow(n)) works without learning a bignum-specific method-call API, which keeps the learning curve close to zero for anyone already writing Rust.

Used by 5 apps in this directory

Rust
86%
Other

Arroyo

Analytics · Data Engineering

5,039

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust 86%
Updated 1 weeks ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,787

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 75%
Updated 4 days ago
Rust
99%
Other

Fluree DB

Databases

469

A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.

View details
87
Repo Health
74
Technical
65
Dependency
Built with
Rust 99%
Updated 5 days ago
C++
44%
BSD 2

Ladybird

Browser

66,342

A truly independent web browser built from scratch — no Chromium, no WebKit, no Gecko.

View details
76
Repo Health
82
Technical
81
Dependency
Built with
C++ 44%
HTML 23%
Rust 20%
Updated 4 days ago
Rust
79%
Apache 2.0

TensorZero

Ab Testing Experimentation · AI Development · Monitoring

11,717

TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.

View details
53
Repo Health
87
Technical
69
Dependency
Built with
Rust 79%
TypeScript 15%
Updated 3 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers