summaryrefslogtreecommitdiff
path: root/src/monocypher.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/monocypher.erl')
-rw-r--r--src/monocypher.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/monocypher.erl b/src/monocypher.erl
index eca8fc4..1788694 100644
--- a/src/monocypher.erl
+++ b/src/monocypher.erl
@@ -1,4 +1,5 @@
-% SPDX-FileCopyrightText: 2020 pukkamustard <pukkamustard@posteo.net>
+% SPDX-FileCopyrightText: 2020-2021 pukkamustard <pukkamustard@posteo.net>
+% SPDX-FileCopyrightText: 2020-2021 rustra <rustra@disroot.org>
%
% SPDX-License-Identifier: LGPL-3.0-or-later
@@ -7,6 +8,8 @@
crypto_unlock/4]).
-export([crypto_blake2b/1,
crypto_blake2b_general/3]).
+-export([crypto_argon2i/5,
+ crypto_argon2i_general/7]).
-export([crypto_ietf_chacha20/3,
crypto_ietf_chacha20_ctr/4]).
-export([crypto_ed25519_public_key/1,
@@ -36,13 +39,29 @@ crypto_unlock(_,_,_,_) ->
crypto_blake2b(_) ->
not_loaded(?LINE).
-
-type crypto_blake2b_hash_size() :: 1..64.
-type crypto_blake2b_key() :: <<_:_*8>>.
-spec crypto_blake2b_general(crypto_blake2b_hash_size(), crypto_blake2b_key(), binary()) -> binary().
crypto_blake2b_general(_,_,_) ->
not_loaded(?LINE).
+%% Password hashing and key derivation
+
+-type crypto_argon2i_hash_size() :: 32..64.
+-type crypto_argon2i_nb_blocks() :: pos_integer().
+-type crypto_argon2i_nb_iterations() :: pos_integer().
+-type crypto_argon2i_password() :: <<_:_*8>>.
+-type crypto_argon2i_salt() :: <<_:_*8>>.
+-spec crypto_argon2i(crypto_argon2i_hash_size(), crypto_argon2i_nb_blocks(), crypto_argon2i_nb_iterations(), crypto_argon2i_password(), crypto_argon2i_salt()) -> binary().
+crypto_argon2i(_,_,_,_,_) ->
+ not_loaded(?LINE).
+
+-type crypto_argon2i_key() :: <<_:_*8>>.
+-type crypto_argon2i_ad() :: <<_:_*8>>.
+-spec crypto_argon2i_general(crypto_argon2i_hash_size(), crypto_argon2i_nb_blocks(), crypto_argon2i_nb_iterations(), crypto_argon2i_password(), crypto_argon2i_salt(), crypto_argon2i_key(), crypto_argon2i_ad()) -> binary().
+crypto_argon2i_general(_,_,_,_,_,_,_) ->
+ not_loaded(?LINE).
+
%% IETF ChaCha20
-type crypto_ietf_chacha20_key() :: <<_:256>>.