README.md

# DeoxysII

This work is derived from: https://github.com/oasisprotocol/deoxysii

## Usage

```elixir
iex> key = <<0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
...>         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f>>
iex> nonce = <<0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e>>
iex> deoxys = DeoxysII.new(key)
iex> ciphertext = <<0x2b, 0x97, 0xbd, 0x77, 0x71, 0x2f, 0x0c, 0xde, 0x97, 0x53, 0x09, 0x95, 0x9d, 0xfe, 0x1d, 0x7c>>
iex> DeoxysII.decrypt(deoxys, nonce, <<>>, ciphertext)
<<>>

# Encrypt and then decrypt a message with associated data
iex> key = <<0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
...>         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f>>
iex> nonce = <<0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e>>
iex> ad = <<0x00, 0x01, 0x02>>
iex> msg = <<0x10, 0x11, 0x12>>
iex> deoxys = DeoxysII.new(key)
iex> ct = DeoxysII.encrypt(deoxys, nonce, ad, msg)
iex> DeoxysII.decrypt(deoxys, nonce, ad, ct)
<<0x10, 0x11, 0x12>>
```

## Installation

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

```elixir
def deps do
  [
    {:deoxysii, "~> 1.0.0"}
  ]
end
```

The docs can be found at <https://hexdocs.pm/deoxysii>.