verushash-rs 0.1.1

Rust bindings for the VerusHash algorithm, providing easy access to Verus hashing functions from Rust.
docs.rs failed to build verushash-rs-0.1.1
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.

verushash-rs

A Rust implementation and wrapper for the VerusHash algorithm, providing native bindings to the cryptographic hashing functions used by the VerusCoin blockchain.
This crate is based on the official verushash-node implementation and offers idiomatic Rust access to all major VerusHash versions.


Features

  • Implements VerusHash V1, V2, V2.1, and V2.2.
  • Simple, safe Rust API with fixed-size [u8; 32] digests.
  • Suitable for mining software, blockchain integrations, and verification tools.
  • Designed to be easy to integrate into existing Rust projects.

Installation

Add this crate to your Cargo.toml:

[dependencies]

verushash = "0.1"

Then bring the functions into scope:

use verushash::{verus_hash_v1, verus_hash_v2, verus_hash_v2_1, verus_hash_v2_2};

Usage

Basic usage example demonstrating all supported versions:

use verushash::{verus_hash_v1, verus_hash_v2, verus_hash_v2_1, verus_hash_v2_2};

fn main() {
    let data = b"VerusHash Example";

    let hash_v1 = verus_hash_v1(data);
    let hash_v2 = verus_hash_v2(data);
    let hash_v2_1 = verus_hash_v2_1(data);
    let hash_v2_2 = verus_hash_v2_2(data);

    println!("VerusHash V1:   {}", hex::encode(hash_v1));
    println!("VerusHash V2:   {}", hex::encode(hash_v2));
    println!("VerusHash V2.1: {}", hex::encode(hash_v2_1));
    println!("VerusHash V2.2: {}", hex::encode(hash_v2_2));
}

Make sure to include the hex crate if you want hexadecimal output:

[dependencies]
verushash = "0.1"
hex = "0.4"

API

Function Description
pub fn verus_hash_v1(data: &[u8]) -> [u8; 32] Computes a VerusHash V1 digest.
pub fn verus_hash_v2(data: &[u8]) -> [u8; 32] Computes a VerusHash V2 digest.
pub fn verus_hash_v2_1(data: &[u8]) -> [u8; 32] Computes a VerusHash V2.1 digest.
pub fn verus_hash_v2_2(data: &[u8]) -> [u8; 32] Computes a VerusHash V2.2 digest.

All functions return a 32-byte (256-bit) hash as a fixed-size array.


Acknowledgements

This project is inspired by and derived from the official VerusCoin verushash-node repository.
All credit for the original VerusHash algorithm and reference implementation goes to the VerusCoin developers.


License

This project is licensed under the MIT License.
See the LICENSE file for details.