Module exonum::crypto [] [src]

Cryptography related types and functions.

Sodium library is used under the hood through sodiumoxide rust bindings.

Structs

Hash

SHA-256 hash.

HashStream

This structure provides a possibility to calculate a SHA-256 hash digest for a stream of data.

PublicKey

Ed25519 public key used to verify digital signatures.

SecretKey

Ed25519 secret key used to create digital signatures over messages.

Seed

Ed25519 seed that can be used for deterministic keypair generation.

SignStream

This structure provides a possibility to create and/or verify Ed25519 digital signatures for a stream of data.

Signature

Ed25519 digital signature.

Constants

HASH_SIZE

Number of bytes in a Digest.

PUBLIC_KEY_LENGTH

Number of bytes in a PublicKey.

SECRET_KEY_LENGTH

Number of bytes in a SecretKey.

SEED_LENGTH

Number of bytes in a Seed.

SIGNATURE_LENGTH

Number of bytes in a Signature.

Traits

CryptoHash

A common trait for the ability to compute a cryptographic hash.

Functions

gen_keypair

Generates a secret key and a corresponding public key using a cryptographically secure pseudo-random number generator.

gen_keypair_from_seed

Computes a secret key and a corresponding public key from a Seed.

hash

Calculates an SHA-256 hash digest of a bytes slice.

init

Initializes the sodium library and chooses faster versions of the primitives if possible.

sign

Signs slice of bytes using the signer's secret key. Returns the resulting Signature.

verify

Verifies that data is signed with a secret key corresponding to the given public key.