tweetNaCl

Undocumented in source.

Members

Enums

crypto_auth_BYTES
anonymousenum crypto_auth_BYTES
Undocumented in source.

Functions

crypto_box
bool crypto_box(ubyte[] c, const(ubyte)[] msg, const(ubyte)[] nonce, const(ubyte)[] pk, const(ubyte)[] sk)

The crypto_box() function encrypts and authenticates a message 'msg' using the sender's secret key 'sk', the receiver's public key 'pk', and a nonce 'nonce'. The crypto_box() function returns the resulting ciphertext 'c'.

crypto_box_afternm
bool crypto_box_afternm(ubyte[] c, const(ubyte)[] msg, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_box_afternm() function encrypts and authenticates a message 'msg' using a secret key 'key' and a nonce 'nonce'. The crypto_box_afternm() function returns the resulting ciphertext 'c'.

crypto_box_beforenm
void crypto_box_beforenm(ubyte[] skey, const(ubyte)[] pk, const(ubyte)[] sk)

Function crypto_box_beforenm() computes a shared secret 's' from public key 'pk' and secret key 'sk'.

crypto_box_keypair
void crypto_box_keypair(ubyte[] pk, ubyte[] sk)

The crypto_box_keypair() function randomly generates a secret key and a corresponding public key.

crypto_box_open
bool crypto_box_open(ubyte[] msg, const(ubyte)[] c, const(ubyte)[] nonce, const(ubyte)[] pk, const(ubyte)[] sk)

The crypto_box_open() function verifies and decrypts a ciphertext 'c' using the receiver's secret key 'sk', the sender's public key 'pk', and a nonce 'nonce'. The crypto_box_open() function returns the resulting message 'msg'.

crypto_box_open_afternm
bool crypto_box_open_afternm(ubyte[] msg, const(ubyte)[] c, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_box_open_afternm() function verifies and decrypts a ciphertext 'c' using a secret key 'key' and a nonce 'nonce'. The crypto_box_open_afternm() function returns the resulting message 'msg'.

crypto_core_hsalsa20
void crypto_core_hsalsa20(ubyte[] output, const(ubyte)[] input, const(ubyte)[] key, const(ubyte)[] constant)
Undocumented in source. Be warned that the author may not have intended to support it.
crypto_core_salsa20
void crypto_core_salsa20(ubyte[] output, const(ubyte)[] input, const(ubyte)[] key, const(ubyte)[] constant)
Undocumented in source. Be warned that the author may not have intended to support it.
crypto_hash
void crypto_hash(ubyte[] output, const(ubyte)[] msg)

The crypto_hash() function hashes a message 'msg'. It returns a hash 'output'. The output length of 'output' should be at least crypto_hash_BYTES.

crypto_onetimeauth
void crypto_onetimeauth(ubyte[] output, const(ubyte)[] msg, const(ubyte)[] key)

The crypto_onetimeauth() function authenticates a message 'msg' using a secret key 'key'. The function returns an authenticator 'output'.

crypto_onetimeauth_verify
bool crypto_onetimeauth_verify(const(ubyte)[] h, const(ubyte)[] msg, const(ubyte)[] key)

The crypto_onetimeauth_verify() function checks that 'h' is a correct authenticator of a message 'msg' under the secret key 'key'.

crypto_secretbox
bool crypto_secretbox(ubyte[] c, const(ubyte)[] msg, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_secretbox() function encrypts and authenticates a message 'msg' using a secret key 'key' and a nonce 'nonce'. The crypto_secretbox() function returns the resulting ciphertext 'c'.

crypto_secretbox_open
bool crypto_secretbox_open(ubyte[] output, const(ubyte)[] c, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_secretbox_open() function verifies and decrypts a ciphertext 'c' using a secret key 'key' and a nonce 'nonce'. The crypto_secretbox_open() function returns the resulting plaintext 'output'.

crypto_sign
void crypto_sign(ubyte[] sm, const(ubyte)[] msg, const(ubyte)[] sk)

The crypto_sign() function signs a message 'msg' using the sender's secret key 'sk'. The crypto_sign() function returns the resulting signed message.

crypto_sign
ubyte[] crypto_sign(const(ubyte)[] msg, const(ubyte)[] sk)

The crypto_sign() function signs a message 'msg' using the sender's secret key 'sk'. The crypto_sign() function returns the resulting signed message.

crypto_sign_keypair
void crypto_sign_keypair(ubyte[] pk, ubyte[] sk)

The crypto_sign_keypair() function randomly generates a secret key and a corresponding public key.

crypto_sign_open
bool crypto_sign_open(ubyte[] msg, const(ubyte)[] sm, const(ubyte)[] pk)

The crypto_sign_open() function verifies the signature in 'sm' using the receiver's public key 'pk'.

crypto_sign_open
ubyte[] crypto_sign_open(const(ubyte)[] sm, const(ubyte)[] pk)

The crypto_sign_open() function verifies the signature in 'sm' using the receiver's public key 'pk'. The crypto_sign_open() function returns the message.

crypto_stream
void crypto_stream(ubyte[] c, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_stream() function produces a stream 'c' as a function of a secret key 'key' and a nonce 'nonce'.

crypto_stream_salsa20
void crypto_stream_salsa20(ubyte[] c, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_stream_salsa20() function produces a stream 'c' as a function of a secret key 'key' and a nonce 'nonce'.

crypto_stream_salsa20_xor
void crypto_stream_salsa20_xor(ubyte[] output, const(ubyte)[] msg, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_stream_salsa20_xor() function encrypts a message 'msg' using a secret key 'key' and a nonce 'nonce'. The crypto_stream_salsa20_xor() function returns the ciphertext 'output'.

crypto_stream_xor
void crypto_stream_xor(ubyte[] c, const(ubyte)[] msg, const(ubyte)[] nonce, const(ubyte)[] key)

The crypto_stream_xor() function encrypts a message 'msg' using a secret key 'key' and a nonce 'nonce'. The crypto_stream_xor() function returns the ciphertext 'c'.

crypto_verify_16
bool crypto_verify_16(const(ubyte)[] x, const(ubyte)[] y)

The crypto_verify_16() function checks that strings 'x' and 'y' has same content.

crypto_verify_32
bool crypto_verify_32(const(ubyte)[] x, const(ubyte)[] y)

The crypto_verify_32() function checks that strings 'x' and 'y' has same content.

Variables

randombytes
void delegate(ubyte[] dest, size_t len) randombytes;

set this callback to good (cryptograpic strong) random bytes generator you can use /dev/urandom as prng

Meta