Module exonum::crypto [] [src]

Cryptography related types and functions.

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

Reexports

pub use encoding::serialize::HexValue;

Structs

Hash

SHA256 hash.

HashStream

This structure provides a possibility to calculate hash for a stream of data

PublicKey

Public key used for verifying signatures.

SecretKey

Secret key used for signing.

Seed

Seed that can be used for keypair generation.

SignStream

This structure provides a possibility to create signature for a stream of data

Signature

Signature.

Enums

FromHexError

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.

Functions

gen_keypair

Randomly generates a secret key and a corresponding public key.

gen_keypair_from_seed

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

hash

Calculates SHA256 hash of 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.