Encode Argon2id hashes

This commit is contained in:
Frank Denis 2017-06-28 15:49:28 +02:00
parent 16e9619d87
commit c8425e6386
2 changed files with 13 additions and 10 deletions

View File

@ -428,9 +428,12 @@ encode_string(char *dst, size_t dst_len, argon2_context *ctx, argon2_type type)
int validation_result;
if (type == Argon2_i) {
SS("$argon2i$v=");
} else {
switch (type) {
case Argon2_id:
SS("$argon2id$v="); break;
case Argon2_i:
SS("$argon2i$v="); break;
default:
return ARGON2_ENCODING_FAIL;
}
validation_result = validate_inputs(ctx);

View File

@ -46,7 +46,7 @@ size_t crypto_pwhash_argon2id_strbytes(void);
SODIUM_EXPORT
const char *crypto_pwhash_argon2id_strprefix(void);
#define crypto_pwhash_argon2id_OPSLIMIT_MIN 3U
#define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_opslimit_min(void);
@ -62,27 +62,27 @@ size_t crypto_pwhash_argon2id_memlimit_min(void);
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_memlimit_max(void);
#define crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 4U
#define crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 2U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_opslimit_interactive(void);
#define crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 33554432U
#define crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 67108864U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_memlimit_interactive(void);
#define crypto_pwhash_argon2id_OPSLIMIT_MODERATE 6U
#define crypto_pwhash_argon2id_OPSLIMIT_MODERATE 3U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_opslimit_moderate(void);
#define crypto_pwhash_argon2id_MEMLIMIT_MODERATE 134217728U
#define crypto_pwhash_argon2id_MEMLIMIT_MODERATE 268435456U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_memlimit_moderate(void);
#define crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 8U
#define crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 4U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_opslimit_sensitive(void);
#define crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 536870912U
#define crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 1073741824U
SODIUM_EXPORT
size_t crypto_pwhash_argon2id_memlimit_sensitive(void);