Module sn_client::utils[][src]

Utility functions.

Modules

test_utils

Common utility functions for writing test cases.

Constants

SYM_ENC_KEY_LEN

Length of the symmetric encryption key.

SYM_ENC_NONCE_LEN

Length of the nonce used for symmetric encryption.

Functions

bin_data_format

Convert binary data to a diplay-able format

generate_nonce

Generates a nonce for symmetric encryption

generate_random_string

Generates a String from length random UTF-8 chars. Note that the NULL character will be excluded to allow conversion to a CString if required, and that the actual len() of the returned String will likely be around 4 * length as most of the randomly-generated chars will consume 4 elements of the String.

generate_random_vector

Generates a random vector using provided length.

generate_readable_string

Generates a readable String using provided length and only ASCII characters.

generate_sym_enc_key

Generates a symmetric encryption key

symmetric_decrypt

Symmetric decryption.

symmetric_encrypt

Symmetric encryption. If nonce is None, then it will be generated randomly.

Type Definitions

SymEncKey

Symmetric encryption key

SymEncNonce

Symmetric encryption nonce