argon2-encoding.h 1.0 KB

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