-
Notifications
You must be signed in to change notification settings - Fork 3
/
pasta-bindings.h
65 lines (41 loc) · 1.9 KB
/
pasta-bindings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <cstdint>
#include <cstdlib>
// Holds possible configuration options
// See the [module level documentation](index.html) for more information.
struct Config;
// Password hashing primitives
//
// Each variant is backed up by different implementation.
// Internally, primitives can either be static values, for example,
// the `lazy_static` generated value `DEFAULT_PRIM`, or dynamically allocated
// variables, which are `Arc<Box<...>>`.
//
// Most operations are expected to be performed using the static functions,
// since most use the default algorithms. However, the flexibilty to support
// arbitrary parameter sets is essential.
struct Primitive;
extern "C" {
char *config_hash_password(const Config *config, const char *password);
char *config_migrate_hash(const Config *config, const char *hash);
bool config_verify_password(const Config *config, const char *hash, const char *password);
bool config_verify_password_update_hash(const Config *config,
const char *hash,
const char *password,
char **new_hash);
Config *config_with_primitive(const Primitive *prim);
Primitive *default_argon2i();
Primitive *default_bcrypt();
Primitive *default_pbkdf2i();
Primitive *default_scrypt();
void free_Config(Config *config);
void free_Primitive(Primitive *prim);
void free_string(char *s);
char *hash_password(const char *password);
char *migrate_hash(const char *hash);
Primitive *new_argon2i(unsigned int passes, unsigned int lanes, unsigned int kib);
Primitive *new_bcrypt(unsigned int cost);
Primitive *new_scrypt(unsigned char log_n, unsigned int r, unsigned int p);
char *read_password(const char *prompt);
bool verify_password(const char *hash, const char *password);
bool verify_password_update_hash_in_place(const char *hash, const char *password, char **new_hash);
} // extern "C"