abla/crypto/chacha20poly1305

Generated from source.

Import with import "abla/crypto/chacha20poly1305".

Source: abla/crypto/chacha20poly1305/entry.ab

Re-exports abla/crypto/result.

chaCha20Poly1305Seal (fun)

trusted fun chaCha20Poly1305Seal(key: string, nonce: string, plaintext: string,
    associatedData: string = ""): CryptoResult

RFC 8439 §2.8's AEAD: the ciphertext and then the 16-byte tag.

chaCha20Poly1305Open (fun)

trusted fun chaCha20Poly1305Open(key: string, nonce: string, sealed: string,
    associatedData: string = ""): CryptoResult

Opens what Seal made: the plaintext, or a failure that says nothing of which part was wrong.

chaCha20Xor (fun)

trusted fun chaCha20Xor(key: string, counter: int, nonce: string, data: string): CryptoResult

ChaCha20 (RFC 8439 §2.4): data xor the keystream, block counter counter for the first block.

poly1305 (fun)

trusted fun poly1305(key: string, message: string): CryptoResult

Poly1305 (RFC 8439 §2.5): the 16-byte tag of message under the 32-byte one-time key.

CHACHA20_POLY1305_RANDOM_NONCE_SIZE (val)

val CHACHA20_POLY1305_RANDOM_NONCE_SIZE

The size of the nonce chaCha20Poly1305SealRandom draws and puts first in its box.

chaCha20Poly1305SealRandom (fun)

trusted fun chaCha20Poly1305SealRandom(key: string, plaintext: string, associatedData: string = ""): CryptoResult

ChaCha20-Poly1305 with a fresh random 12-byte nonce (from the system, or from cryptoSetRandom's source): the nonce, the ciphertext and the 16-byte tag, as one box for chaCha20Poly1305OpenRandom. Fails without randomness. A random 96-bit nonce is safe for at most 2^32 messages under one key (the chance of a repeated nonce stays below 2^-32); a sender with more must change the key before that, or count its nonces itself and use chaCha20Poly1305Seal. Never reuse a nonce under a key: one repeat reveals the XOR of two plaintexts and the one-time authentication key.

chaCha20Poly1305OpenRandom (fun)

trusted fun chaCha20Poly1305OpenRandom(key: string, box: string, associatedData: string = ""): CryptoResult

Opens what chaCha20Poly1305SealRandom made (the nonce first), or fails with the message of chaCha20Poly1305Open.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.