Cryptography primitives for Exonum
exonum-crypto
provides a high-level API for work with various cryptography tasks.
Capabilities of exonum-crypto
include:
- Calculating the hash of data;
- Generating key pairs for work with digital signatures;
- Creating and verifying of digital signatures.
The main backend for exonum-crypto
is sodiumoxide
, and the used algorithms are:
- SHA-256 for hashing.
- Ed25519 for digital signatures.
Consult the crate docs for more details.
Examples
Signing data and verifying the signature:
;
let = gen_keypair;
let data = ;
let signature = sign;
assert!;
init
Hashing fixed amount of data:
;
let data = ;
let hash = hash;
init
Hashing data by chunks:
use HashStream;
init;
let data: = vec!;
let mut hash_stream = new;
for chunk in data
let _ = hash_stream.hash;
Usage
Include exonum-crypto
as a dependency in your Cargo.toml
:
[]
= "1.0.0"
License
exonum-crypto
is licensed under the Apache License (Version 2.0).
See LICENSE for details.