#multi-hash #sha-2 #blake2 #blot #object-hash

blot-lib

Blot library implements Objecthash mixed with Multihash

3 releases

Uses old Rust 2015

0.1.2 Nov 29, 2018
0.1.1 Oct 17, 2018
0.1.0 Oct 17, 2018

#6 in #multihash

28 downloads per month
Used in blot

MIT license

70KB
2K SLoC

Blot library

The Blot library lays the primitives to compute hashes using a variation of Ben Laurie's objecthash combined with Multihash.

Licensed under MIT (See LICENSE).


lib.rs:

Blot library

blot computes the checksum for the given blob of data following the Objecthash algorithm adapted to work with Multihash hints.

blot foundation is the trait Blot. By default all Rust's primitives are implemented (See core). If you need more flexibility, either implement it for your types or use value::Value.

Blot requires a hashing function implementing the Multihash trait. The default feature enables SHA1, SHA2, SHA3 and Blake2.

Example: primitives

use blot::core::Blot;
use blot::multihash::Sha3256;

println!("{}", "foo".digest(Sha3256));
println!("{}", 1.digest(Sha3256));
println!("{}", vec![1, 2, 3].digest(Sha3256));

Example: mixed collections

Mixed collections require a type able to describe them consistently, like the value::Value enum.

#[macro_use]
extern crate blot;
use blot::core::Blot;
use blot::multihash::Sha3256;
use blot::value::Value;

fn main() {
    let value: Value<Sha3256> = set!{"foo", "bar", list![1, 1.0], set!{}};

    println!("{}", value.digest(Sha3256));
}

Dependencies

~0–1.1MB
~18K SLoC