Skip to content

An Elixir NaCl/libsodium-lite Salsa20/ChaCha20 encryption tool

License

Notifications You must be signed in to change notification settings

BrandtHill/Salchicha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Salchicha

hex.pm Build Status

A pure-ish Elixir cryptography tool for the Salsa20 and ChaCha20 ciphers.

Installation

The package can be installed by adding salchicha to your list of dependencies in mix.exs:

def deps do
  [
    {:salchicha, "~> 0.4"}
  ]
end

Usage

iex()> key = Salchicha.generate_secret_key()
iex()> nonce = Salchicha.generate_nonce()
iex()> "Hello, World!"
       |> Salchicha.secretbox(nonce, key)
       |> Salchicha.secretbox_open(nonce, key) 
       |> IO.iodata_to_binary()
"Hello, World!"

Background

The purpose of this library is to have a lightweight, NaCl/libsodium compatible tool for symmetric key encryption/decryption that doesn't depend on any other packages or NIFs.

KCl is an impressive pure-elixir NaCl/libsodium library we had previously used for Discord Voice encryption in nostrum. While adding support for newer encryption modes, I opted to remove :kcl in favor of leveraging what was available via erlang's native :crypto module and implementing the rest more adroitly. That code has since been migrated into this library, and more of the NaCl/libsodium API has been added.

NaCl/libsodium (and Kcl) has functionality for public key cryptography, namely ECDH key exchange via X25519 and EdDSA signatures via Ed25519. The :crypto module already supports these elliptic curves, so I've added some sodium-flavored wrappers around those functions.

About

An Elixir NaCl/libsodium-lite Salsa20/ChaCha20 encryption tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages