2 * IRC - Internet Relay Chat, include/ircd_crypt.h
3 * Copyright (C) 2002 hikari
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 1, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * @brief Core password encryption and hashing APIs.
23 #ifndef INCLUDED_ircd_crypt_h
24 #define INCLUDED_ircd_crypt_h
26 /* forward planning for modularisation */
28 char* mechname; /* name of the mechanism */
29 char* shortname; /* short name of the module */
30 char* description; /* description of the mechanism */
32 const char* (*crypt_function)(const char *, const char *);
33 /* pointer to the crypt function */
35 char* crypt_token; /* what identifies a password string
36 as belonging to this mechanism */
38 int crypt_token_size; /* how long is the token */
41 typedef struct crypt_mech_s crypt_mech_t;
44 typedef struct crypt_mechs_s crypt_mechs_t;
46 struct crypt_mechs_s {
53 #define MechName(x) x->mechname
54 #define ShortName(x) x->shortname
55 #define Description(x) x->description
56 #define CryptFunc(x) x->crypt_function
57 #define CryptTok(x) x->crypt_token
58 #define CryptTokSize(x) x->crypt_token_size
60 /* exported functions */
61 extern void ircd_crypt_init(void);
62 extern const char* ircd_crypt(const char* key, const char* salt);
63 extern int ircd_crypt_register_mech(crypt_mech_t* mechanism);
64 extern int ircd_crypt_unregister_mech(crypt_mech_t* mechanism);
66 /* exported variables */
67 extern crypt_mechs_t* crypt_mechs_root;
69 #endif /* INCLUDED_ircd_crypt_h */