9 releases

✓ Uses Rust 2018 edition

0.3.1 Mar 24, 2020
0.3.0 Feb 13, 2020
0.2.1 Feb 7, 2020
0.0.9 Feb 4, 2020
0.0.1 Mar 29, 2019

#64 in Cryptography

Download history 2/week @ 2019-12-17 3/week @ 2019-12-24 18/week @ 2020-01-07 33/week @ 2020-01-14 4/week @ 2020-01-21 2/week @ 2020-01-28 53/week @ 2020-02-04 94/week @ 2020-02-11 170/week @ 2020-02-18 212/week @ 2020-02-25 252/week @ 2020-03-03 245/week @ 2020-03-10 336/week @ 2020-03-17 298/week @ 2020-03-24 159/week @ 2020-03-31

490 downloads per month
Used in 11 crates (10 directly)

BSD-3-Clause

255KB
4K SLoC

Tari Crypto

This crate is part of the Tari Cryptocurrency project.

Major features of this library include:

  • Pedersen commitments
  • Schnorr Signatures
  • Generic Public and Secret Keys
  • Musig!

The tari_crypto crate makes heavy use of the excellent Dalek libraries. The default implementation for Tari ECC is the Ristretto255 curve.

Compiling to WebAssembly

To build the WebAssembly module, the wasm feature must be enabled:

$ wasm-pack build . -- --features "wasm"

To generate a module for use in node.js, use this command:

$ wasm-pack build --target nodejs -d tari_js . -- --features "wasm"

Example (Node.js)

const keys = KeyRing.new();

// Create new keypair
keys.new_key("Alice");
keys.new_key("Bob");
console.log(`${keys.len()} keys in ring`); // 2
console.log("kA = ", keys.private_key("Alice"));
console.log("PB = ", keys.public_key("Bob"));
keys.free();

Benchmarks

To run the benchmarks:

$ cargo bench

The benchmarks use Criterion and will produce nice graphs (if you have gnuplot installed)

To run the benchmarks with SIMD instructions:

$ cargo bench --features "avx2"

Change log

v0.2.0

General

  • WASM and crate version now match. Eliminate that confusion.

WASM module

  • Breaking change: KeyRing.sign doesn't take a nonce any more. It's not needed, and why risk someone re-using it?
  • New method: key_utils.sign to sign keys not in the key ring
  • New module: Commitments

Dependencies

~6.5MB
~103K SLoC