luajitos

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

Argon2.h (1240B)


      1 /*
      2  * Argon2id Header
      3  * RFC 9106
      4  */
      5 
      6 #ifndef ARGON2_H
      7 #define ARGON2_H
      8 
      9 #include <stdint.h>
     10 #include <stddef.h>
     11 
     12 #ifdef __cplusplus
     13 extern "C" {
     14 #endif
     15 
     16 /* Recommended parameters */
     17 #define ARGON2_TIME_DEFAULT 3        /* iterations */
     18 #define ARGON2_MEMORY_DEFAULT 65536  /* 64 MB in KB */
     19 
     20 /**
     21  * Argon2id - Password hashing function
     22  *
     23  * @param password Password to hash
     24  * @param pwdlen Password length
     25  * @param salt Salt (at least 16 bytes recommended)
     26  * @param saltlen Salt length
     27  * @param t_cost Time cost (iterations, minimum 1, recommended 3+)
     28  * @param m_cost Memory cost in KB (minimum 8, recommended 65536 = 64MB)
     29  * @param out Output buffer
     30  * @param outlen Output length (typically 32 bytes)
     31  * @return 0 on success, -1 on error
     32  */
     33 int argon2id(const uint8_t *password, size_t pwdlen,
     34              const uint8_t *salt, size_t saltlen,
     35              uint32_t t_cost, uint32_t m_cost,
     36              uint8_t *out, size_t outlen);
     37 
     38 /**
     39  * Argon2id with recommended defaults (3 iterations, 64MB memory)
     40  */
     41 int argon2id_simple(const uint8_t *password, size_t pwdlen,
     42                     const uint8_t *salt, size_t saltlen,
     43                     uint8_t *out, size_t outlen);
     44 
     45 #ifdef __cplusplus
     46 }
     47 #endif
     48 
     49 #endif /* ARGON2_H */