| Crates.io | bitcoin-bigint |
| lib.rs | bitcoin-bigint |
| version | 0.1.18 |
| created_at | 2025-07-09 00:40:06.116089+00 |
| updated_at | 2025-07-09 00:40:06.116089+00 |
| description | Provides an efficient macro-based approach to define and manipulate arbitrary-precision unsigned integers, crucial for cryptographic operations on Bitcoin. |
| homepage | |
| repository | https://github.com/klebs6/bitcoin-rs |
| max_upload_size | |
| id | 1743743 |
| size | 368,313 |
bitcoin-bigint is a Rust library that offers a macro-based system to define arbitrary-precision unsigned integer operations. It caters to Bitcoin and cryptography needs where manipulating large integers safely and efficiently is crucial.
This crate provides macros that define large unsigned integer types (BaseUInt32, BaseUInt64, BaseUInt128, BaseUInt160, BaseUInt256) along with their associated arithmetic operations. Using these macros, developers can perform operations such as addition, subtraction, multiplication, division, bitwise operations, and shifts on large integers with adjustable bit-width.
To use the bitcoin-bigint crate, add the following to your Cargo.toml:
[dependencies]
bitcoin-bigint = "0.1.18"
Then, you can define your own unsigned integer operations:
use bitcoin_bigint::{bigint, BaseUInt256};
fn main() {
let mut num = BaseUInt256::from(100u64);
let addend = BaseUInt256::from(50u64);
num += &addend;
println!("Result of addition: {}", num.to_string());
}
For more information and to contribute, visit the GitHub repository.
Licensed under MIT License.
The README.md file is generated by an AI model and may not be 100% accurate; however, it should be pretty good.