Skip to content

Commit 810d070

Browse files
committed
replace :aes_256_gcm with :aes_gcm #118
1 parent 0620ad9 commit 810d070

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Add the `fields` package to your list of dependencies in your `mix.exs` file:
7878
```elixir
7979
def deps do
8080
[
81-
{:fields, "~> 2.10.0"}
81+
{:fields, "~> 2.10.2"}
8282
]
8383
end
8484
```

lib/aes.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ defmodule Fields.AES do
66
this makes "bruteforce" decryption much more difficult.
77
See `encrypt/1` and `decrypt/1` for more details.
88
"""
9-
# Use AES 256 Bit Keys for Encryption.
9+
# Use AES 256 Bit Keys for Encryption. (aad = "Associated Authenticated Data")
1010
@aad "AES256GCM"
11+
@cipher :aes_gcm
1112
@doc """
1213
Encrypt Using AES GCM.
1314
Uses a random IV for each call, and prepends the IV and Tag to the
@@ -34,7 +35,7 @@ defmodule Fields.AES do
3435
key = get_key(key_id)
3536

3637
{ciphertext, tag} =
37-
:crypto.crypto_one_time_aead(:aes_256_gcm, key, iv, to_string(plaintext), @aad, true)
38+
:crypto.crypto_one_time_aead(@cipher, key, iv, to_string(plaintext), @aad, true)
3839

3940
# 1 >> "0001"
4041
key_id_str = String.pad_leading(to_string(key_id), 4, "0")

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defmodule Fields.MixProject do
55
[
66
app: :fields,
77
description: "A collection of useful fields for building Phoenix apps faster!",
8-
version: "2.10.1",
8+
version: "2.10.2",
99
elixir: ">= 1.10.0",
1010
start_permanent: Mix.env() == :prod,
1111
deps: deps(),

0 commit comments

Comments
 (0)