miniBill/elm-salsa20/1.0.0

Salsa20

salsa20 : Key -> Nonce -> Bytes -> Bytes

Encrypt/decrypt data using the Salsa20 function.

This function is symmetric, so it can be used for both encryption and decryption.

Key management

type alias Key =
Key

Encryption key.

toKey : Bytes -> Maybe Key

Build a key out of bytes. The key must be either 16 or 32 bytes long.

type alias Nonce =
Nonce

Nonce. A random unique code that should be unique for each message.

toNonce : Bytes -> Maybe Nonce

Build a nonce out of bytes. The nonce must be either 8 bytes long.