# 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`:
```text
[dependencies]
fides = "2.3.0"
```
In your `module.rs`:
```text
use fides::{ chacha20poly1305, ed25519, hash, merkle_root, x25519 };
```
## API
### Hashing
```text
let object: Vec<u8>;
let object_hash = hash(&object[..]);
```
### ChaCha20Poly1305
```text
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
```text
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
```text
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
```text
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