crypto_pwhash_argon2i.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef crypto_pwhash_argon2i_H
  2. #define crypto_pwhash_argon2i_H
  3. #include <limits.h>
  4. #include <stddef.h>
  5. #include <stdint.h>
  6. #include "export.h"
  7. #ifdef __cplusplus
  8. # ifdef __GNUC__
  9. # pragma GCC diagnostic ignored "-Wlong-long"
  10. # endif
  11. extern "C" {
  12. #endif
  13. #define crypto_pwhash_argon2i_ALG_ARGON2I13 1
  14. SODIUM_EXPORT
  15. int crypto_pwhash_argon2i_alg_argon2i13(void);
  16. #define crypto_pwhash_argon2i_BYTES_MIN 16U
  17. SODIUM_EXPORT
  18. size_t crypto_pwhash_argon2i_bytes_min(void);
  19. #define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
  20. SODIUM_EXPORT
  21. size_t crypto_pwhash_argon2i_bytes_max(void);
  22. #define crypto_pwhash_argon2i_PASSWD_MIN 0U
  23. SODIUM_EXPORT
  24. size_t crypto_pwhash_argon2i_passwd_min(void);
  25. #define crypto_pwhash_argon2i_PASSWD_MAX 4294967295U
  26. SODIUM_EXPORT
  27. size_t crypto_pwhash_argon2i_passwd_max(void);
  28. #define crypto_pwhash_argon2i_SALTBYTES 16U
  29. SODIUM_EXPORT
  30. size_t crypto_pwhash_argon2i_saltbytes(void);
  31. #define crypto_pwhash_argon2i_STRBYTES 128U
  32. SODIUM_EXPORT
  33. size_t crypto_pwhash_argon2i_strbytes(void);
  34. #define crypto_pwhash_argon2i_STRPREFIX "$argon2i$"
  35. SODIUM_EXPORT
  36. const char *crypto_pwhash_argon2i_strprefix(void);
  37. #define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U
  38. SODIUM_EXPORT
  39. size_t crypto_pwhash_argon2i_opslimit_min(void);
  40. #define crypto_pwhash_argon2i_OPSLIMIT_MAX 4294967295U
  41. SODIUM_EXPORT
  42. size_t crypto_pwhash_argon2i_opslimit_max(void);
  43. #define crypto_pwhash_argon2i_MEMLIMIT_MIN 8192U
  44. SODIUM_EXPORT
  45. size_t crypto_pwhash_argon2i_memlimit_min(void);
  46. #define crypto_pwhash_argon2i_MEMLIMIT_MAX \
  47. ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
  48. SODIUM_EXPORT
  49. size_t crypto_pwhash_argon2i_memlimit_max(void);
  50. #define crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 4U
  51. SODIUM_EXPORT
  52. size_t crypto_pwhash_argon2i_opslimit_interactive(void);
  53. #define crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 33554432U
  54. SODIUM_EXPORT
  55. size_t crypto_pwhash_argon2i_memlimit_interactive(void);
  56. #define crypto_pwhash_argon2i_OPSLIMIT_MODERATE 6U
  57. SODIUM_EXPORT
  58. size_t crypto_pwhash_argon2i_opslimit_moderate(void);
  59. #define crypto_pwhash_argon2i_MEMLIMIT_MODERATE 134217728U
  60. SODIUM_EXPORT
  61. size_t crypto_pwhash_argon2i_memlimit_moderate(void);
  62. #define crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 8U
  63. SODIUM_EXPORT
  64. size_t crypto_pwhash_argon2i_opslimit_sensitive(void);
  65. #define crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 536870912U
  66. SODIUM_EXPORT
  67. size_t crypto_pwhash_argon2i_memlimit_sensitive(void);
  68. SODIUM_EXPORT
  69. int crypto_pwhash_argon2i(unsigned char * const out,
  70. unsigned long long outlen,
  71. const char * const passwd,
  72. unsigned long long passwdlen,
  73. const unsigned char * const salt,
  74. unsigned long long opslimit, size_t memlimit,
  75. int alg)
  76. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
  77. SODIUM_EXPORT
  78. int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
  79. const char * const passwd,
  80. unsigned long long passwdlen,
  81. unsigned long long opslimit, size_t memlimit)
  82. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
  83. SODIUM_EXPORT
  84. int crypto_pwhash_argon2i_str_verify(const char str[crypto_pwhash_argon2i_STRBYTES],
  85. const char * const passwd,
  86. unsigned long long passwdlen)
  87. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
  88. SODIUM_EXPORT
  89. int crypto_pwhash_argon2i_str_needs_rehash(const char str[crypto_pwhash_argon2i_STRBYTES],
  90. unsigned long long opslimit, size_t memlimit)
  91. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif