billstclair/elm-crypto-string/2.0.2

NOTE: this package is not compatible with Elm 0.19.1

Crypto.Strings

Block chaining and string encryption for use with any block cipher.

Functions

encrypt : Seed -> Passphrase -> Plaintext -> Result String ( Ciphertext, Seed )

Encrypt a string. Encode the output as Base64 with 80-character lines.

The Seed parameter is a Random.Seed, as created by Random.initialSeed

See Crypto.Strings.Crypt.encrypt for more options.

This shouldn't ever return an error, but since the key generation can possibly do so, it returns a Result instead of just (Ciphertext, randomState).

justEncrypt : Seed -> Passphrase -> Plaintext -> Ciphertext

Testing function. Just returns the result with no random generator update.

decrypt : Passphrase -> Ciphertext -> Result String Plaintext

Decrypt a string created with encrypt.

See Crypto.Strings.Crypt.decrypt for more options.

This can get errors if the ciphertext you pass in decrypts to something that isn't a UTF-8 string.