Documentation ¶
Index ¶
Constants ¶
const NonceSize = 24
Variables ¶
This section is empty.
Functions ¶
func Stream ¶
Stream produces a l-byte stream as a function of a secret key k and a nonce n. Note that it is the caller's responsibility to ensure the uniqueness of nonces—for example, by using nonce 1 for the first message, nonce 2 for the second message, etc. Nonces are long enough that randomly generated nonces have negligible risk of collision.
func XOR ¶
XOR encrypts a message m using a secret key k and a nonce n. XOR returns the ciphertext c. Note that it is the caller's responsibility to ensure the uniqueness of nonces—for example, by using nonce 1 for the first message, nonce 2 for the second message, etc. Nonces are long enough that randomly generated nonces have negligible risk of collision.
Note also that encrypting a message with XOR does not protect against that message being tampered with in transit. To detect tampering, combine encryption with an authenticator, like the one provided by nacl/secretbox.
Types ¶
This section is empty.