| Crates.io | bitcoin-u160 |
| lib.rs | bitcoin-u160 |
| version | 0.1.18 |
| created_at | 2025-07-09 00:41:44.367756+00 |
| updated_at | 2025-07-09 00:41:44.367756+00 |
| description | A Rust crate for efficiently handling 160-bit opaque blobs, commonly used in cryptographic and Bitcoin-related contexts, with support for conversion from strings and byte arrays. |
| homepage | |
| repository | https://github.com/klebs6/bitcoin-rs |
| max_upload_size | |
| id | 1743746 |
| size | 189,210 |
The bitcoin-u160 crate provides an efficient representation for handling 160-bit opaque data blobs, typically used in Bitcoin and cryptographic applications. This crate is especially useful for developers seeking a robust, low-level interface for managing and manipulating 160-bit data structures without the overhead of integer operations.
u160 offers methods to construct from strings, vectors, and byte arrays, maintaining the integrity and validity of 160-bit data.u160 object at compile-time using 20-byte arrays.Debug traits and supports tracing for observability.Add bitcoin-u160 to your Cargo.toml:
[dependencies]
bitcoin-u160 = "0.1.18"
use bitcoin_u160::u160;
fn main() {
// Create a u160 instance from a hexadecimal string
let my_u160 = u160::from("0123456789abcdef0123456789abcdef01234567");
println!("{:?}", my_u160);
// Convert a byte array into a u160 instance
let bytes: [u8; 20] = [0u8; 20];
let my_u160_from_bytes = u160::from_le_bytes(bytes);
println!("{:?}", my_u160_from_bytes);
}
For detailed documentation and further examples, visit the repository.
This README file was generated by an AI model and may not be 100% accurate. However, it should provide a good foundational understanding of how to work with the bitcoin-u160 crate.