bitcoin-bigint 0.1.18

Provides an efficient macro-based approach to define and manipulate arbitrary-precision unsigned integers, crucial for cryptographic operations on Bitcoin.
docs.rs failed to build bitcoin-bigint-0.1.18
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

bitcoin-bigint

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.

Overview

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.

Key Features

  • Arbitrary Precision: Define unsigned integers with sizes from 32 bits to 256 bits.
  • Comprehensive Operations: Full suite of arithmetic, bitwise, and shift operations tailored to large integers.
  • Hexadecimal Support: Convert integers to and from hexadecimal string representation seamlessly.
  • Random Generation: Simple random number generator for testing and utility functions.

Usage

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());
}

Repository

For more information and to contribute, visit the GitHub repository.

License

Licensed under MIT License.

Disclaimer

The README.md file is generated by an AI model and may not be 100% accurate; however, it should be pretty good.