Initial commit
[keepassx] / src / apg / randpass.h
1 /*
2 ** Copyright (c) 1999, 2000, 2001, 2002, 2003
3 ** Adel I. Mirzazhanov. All rights reserved
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 
9 **     1.Redistributions of source code must retain the above copyright notice,
10 **       this list of conditions and the following disclaimer. 
11 **     2.Redistributions in binary form must reproduce the above copyright
12 **       notice, this list of conditions and the following disclaimer in the
13 **       documentation and/or other materials provided with the distribution. 
14 **     3.The name of the author may not be used to endorse or promote products
15 **       derived from this software without specific prior written permission. 
16 **                
17 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND ANY EXPRESS
18 ** OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ** ARE DISCLAIMED.  IN  NO  EVENT  SHALL THE AUTHOR BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE
23 ** GOODS OR SERVICES;  LOSS OF USE,  DATA,  OR  PROFITS;  OR BUSINESS
24 ** INTERRUPTION)  HOWEVER  CAUSED  AND  ON  ANY  THEORY OF LIABILITY,
25 ** WHETHER  IN  CONTRACT,   STRICT   LIABILITY,  OR  TORT  (INCLUDING
26 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 /*
31 ** randpass.h
32 */
33 #ifndef APG_RANDPASS_H
34 #define APG_RANDPASS_H  1
35
36 /*#ifndef APG_RND_H
37 #include "rnd.h"
38 #endif*/
39
40 #ifndef APG_OWN_TYPES_H
41 #include "owntypes.h"
42 #endif
43
44 #define S_NB    0x01 /* Numeric */
45 #define S_SS    0x02 /* Special */
46 #define S_CL    0x04 /* Capital */
47 #define S_SL    0x08 /* Small   */
48 #define S_RS    0x10 /* Restricted Symbol*/
49
50 struct sym
51  {
52   char   ch;
53   USHORT type;
54  };
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /* char gen_symbol(unsigned short int symbol_class); */
61 extern int gen_rand_pass(char* password_string, int minl,
62                          int maxl, unsigned int pass_mode);
63 extern int gen_rand_symbol (char *symbol, unsigned int mode);
64 extern int is_restricted_symbol (char symbol);
65
66 #ifdef __cplusplus
67 }
68 #endif
69
70 #endif /* RANDPASS_H */