#blake3 #ed25519 #merkle-tree #hashing #lang #x25519 #merkle #asymmetric #tree #chacha20poly1305

fides

Fides is a library for hashing with blake3, asymmetric cryptography on curve 25519, symmetric cryptography with chacha20poly1305 and merkle tree functions

11 releases (7 stable)

Uses new Rust 2021

2.3.0 Apr 29, 2022
2.2.1 Apr 9, 2022
2.0.0 Feb 26, 2022
1.0.0 Feb 26, 2022
0.1.0 Sep 23, 2021

#459 in Cryptography

Download history 87/week @ 2022-06-03 10/week @ 2022-06-10 17/week @ 2022-06-17 12/week @ 2022-06-24 24/week @ 2022-07-01 21/week @ 2022-07-08 32/week @ 2022-07-15 39/week @ 2022-07-22 27/week @ 2022-07-29 30/week @ 2022-08-05 28/week @ 2022-08-12 30/week @ 2022-08-19 22/week @ 2022-08-26 25/week @ 2022-09-02 58/week @ 2022-09-09 17/week @ 2022-09-16

138 downloads per month
Used in fewer than 6 crates

MIT license

7KB
105 lines

Fides

Fides is a library for hashing with blake3, asymmetric cryptography on curve 25519, symmetric cryptography with chacha20poly1305 and merkle tree functions.

Usage

In your Cargo.toml:

[dependencies]
fides = "2.3.0"

In your module.rs:

use fides::{ chacha20poly1305, ed25519, hash, merkle_root, x25519 };

API

Hashing

let object: Vec<u8>;

let object_hash = hash(&object[..]);

ChaCha20Poly1305

let message: Vec<u8>;

let key: [u8; 32] = hash(&"password".as_bytes());

let cipher: Vec<u8> = chacha20poly1305::encrypt(&key, &message[..])?;

let plain: Vec<u8> = chacha20poly1305::decrypt(&key, &cipher[..])?;

Ed25519

let priv_key: [u8;32] = ed25519::private_key();

let signature: [u8; 64] = ed25519::sign(&message, &priv_key);

let pub_key: [u8;32] = ed25519::public_key(&priv_key);

let verification: bool = ed25519::verify(&message, &pub_key, &signature);

x25519

let priv_key: [u8;32] = x25519::private_key();

let pub_key: [u8;32] = x25519::public_key(&priv_key);

let shared_secret_key: [u8;32] = x25519::shared_key(&priv_key, &other_party_pub_key);

Merkle Tree

let hashes: Vec<[u8; 32]>;

let root = merkle_root(hashes);

Contribution

Pull requests, bug reports and any kind of suggestion are welcome.

2022-04-29

Dependencies

~5MB
~106K SLoC