1 #ifndef argon2_encoding_H
2 #define argon2_encoding_H
3 
4 #include "argon2.h"
5 
6 /*
7  * encode an Argon2 hash string into the provided buffer. 'dst_len'
8  * contains the size, in characters, of the 'dst' buffer; if 'dst_len'
9  * is less than the number of required characters (including the
10  * terminating 0), then this function returns 0.
11  *
12  * if ctx->outlen is 0, then the hash string will be a salt string
13  * (no output). if ctx->saltlen is also 0, then the string will be a
14  * parameter-only string (no salt and no output).
15  *
16  * On success, ARGON2_OK is returned.
17  *
18  * No other parameters are checked
19  */
20 int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
21                   argon2_type type);
22 
23 /*
24  * Decodes an Argon2 hash string into the provided structure 'ctx'.
25  * The fields ctx.saltlen, ctx.adlen, ctx.outlen set the maximal salt, ad, out
26  * length values
27  * that are allowed; invalid input string causes an error
28  *
29  * Returned value is ARGON2_OK on success.
30  */
31 int decode_string(argon2_context *ctx, const char *str, argon2_type type);
32 
33 #endif
34