aboutsummaryrefslogtreecommitdiff
path: root/server/_build/default/lib/bcrypt/c_src/bcrypt_nif.h
blob: 9c1cd69c95adec6741937472f7d91b1db3d4c7c1 (plain)
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
#ifndef ERLANG_BCRYPT_BCRYPT_NIF_H
#define ERLANG_BCRYPT_BCRYPT_NIF_H

#include "async_queue.h"

typedef unsigned char byte;

int ts_bcrypt(char *, const char *, const char *);
void encode_salt(char *, u_int8_t *, u_int16_t, u_int8_t);

typedef struct {
    ErlNifResourceType *bcrypt_rt;
} bcrypt_privdata_t;

typedef struct {
    async_queue_t    *queue;
    ErlNifThreadOpts *topts;
    ErlNifTid         tid;
} ctx_t;

typedef enum {
    UNKNOWN,
    SHUTDOWN,
    HASH
} task_type_t;

typedef struct {
    task_type_t  type;
    ErlNifEnv   *env;
    ErlNifPid    pid;
    ERL_NIF_TERM ref;
    union {
        struct {
            ErlNifBinary salt;
            ErlNifBinary password;
        } hash;
    } data;
} task_t;

#endif  // ERLANG_BCRYPT_BCRYPT_NIF_H