2016-01-12 23:52:30 +01:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-10 18:05:48 +01:00
|
|
|
#include <stdbool.h>
|
2019-01-12 21:26:48 +01:00
|
|
|
#include <stddef.h>
|
2018-09-26 17:09:29 +02:00
|
|
|
typedef enum cryptalgo_t {
|
|
|
|
PASSWORD_PLAINTEXT,
|
|
|
|
PASSWORD_BCRYPT
|
|
|
|
} cryptalgo_t;
|
2018-09-26 20:08:38 +02:00
|
|
|
#define PASSWORD_DEFAULT PASSWORD_BCRYPT
|
2018-12-03 19:19:06 +01:00
|
|
|
#define PASSWORD_MAXSIZE 32
|
2016-01-13 16:16:02 +01:00
|
|
|
|
2018-09-26 19:05:49 +02:00
|
|
|
extern int bcrypt_workfactor;
|
|
|
|
|
2017-02-18 21:15:14 +01:00
|
|
|
#define VERIFY_OK 0
|
|
|
|
#define VERIFY_FAIL 1
|
|
|
|
#define VERIFY_UNKNOWN 2
|
2016-01-14 15:49:09 +01:00
|
|
|
int password_verify(const char *hash, const char *passwd);
|
2018-09-26 21:06:56 +02:00
|
|
|
const char * password_hash(const char *passwd, cryptalgo_t algo);
|
2018-09-26 17:09:29 +02:00
|
|
|
bool password_is_implemented(cryptalgo_t algo);
|
2019-01-12 21:26:48 +01:00
|
|
|
void password_generate(char *password, size_t length);
|