bitcoin-blob

Crates.iobitcoin-blob
lib.rsbitcoin-blob
version0.1.18
created_at2025-07-09 00:40:55.20378+00
updated_at2025-07-09 00:40:55.20378+00
descriptionRust library for defining and manipulating fixed-size opaque byte blobs with serialization, deserialization, hex conversion, and byte iteration capability.
homepage
repositoryhttps://github.com/klebs6/bitcoin-rs
max_upload_size
id1743744
size250,180
(klebs6)

documentation

https://docs.rs/bitcoin-blob

README

bitcoin-blob

bitcoin-blob is a highly specialized Rust library designed to handle fixed-size, opaque byte arrays known as blobs. It provides extensive functionality for iterating, serializing, deserializing, hex encoding/decoding, and more.

Features

  • Flexible Blob Definitions: Define blobs of arbitrary bit/byte sizes using powerful macros.
  • Iterators: Seamlessly iterate over blob data in mutable and immutable forms.
  • Serialization: Robust functionality to serialize blobs to and from streams.
  • Hex Utilities: Convert blobs to hexadecimal strings and vice versa.
  • Typical Operations: Includes utility methods for checking if blobs are null, comparing blobs, and basic byte-level manipulations.
  • Deterministic RNG: Includes a simple RNG for deterministic testing purposes.

Usage

Below is an example of how to define and use a 256-bit blob:

#[macro_use]
extern crate bitcoin_blob;

base_blob!(BaseBlob256, 256, 32);

fn main() {
    let mut blob = BaseBlob256::zero();
    blob.set_hex_from_str("abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890");
    println!("Hex: {}", blob.to_string());
}

For comprehensive examples and detailed information on each macro, refer to the documentation.

License

bitcoin-blob is licensed under the MIT License.


Disclaimer: This README.md was generated by an AI model and may not be 100% accurate; however, it should be pretty good.

Commit count: 0

cargo fmt