OLD | NEW |
1 /* | 1 /* |
2 ** This module uses code from the NIST implementation of FIPS-181, | 2 ** This module uses code from the NIST implementation of FIPS-181, |
3 ** but the algorythm is CHANGED and I think that I CAN | 3 ** but the algorythm is CHANGED and I think that I CAN |
4 ** copyright it. See copiright notes below. | 4 ** copyright it. See copiright notes below. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 ** Copyright (c) 1999, 2000, 2001, 2002, 2003 | 8 ** Copyright (c) 1999, 2000, 2001, 2002, 2003 |
9 ** Adel I. Mirzazhanov. All rights reserved | 9 ** Adel I. Mirzazhanov. All rights reserved |
10 ** | 10 ** |
(...skipping 23 matching lines...) Expand all Loading... |
34 */ | 34 */ |
35 | 35 |
36 | 36 |
37 #ifndef APG_PRONPASS_H | 37 #ifndef APG_PRONPASS_H |
38 #define APG_PRONPASS_H 1 | 38 #define APG_PRONPASS_H 1 |
39 | 39 |
40 #ifndef APG_OWN_TYPES_H | 40 #ifndef APG_OWN_TYPES_H |
41 #include "owntypes.h" | 41 #include "owntypes.h" |
42 #endif /* APG_OWN_TYPES_H */ | 42 #endif /* APG_OWN_TYPES_H */ |
43 | 43 |
44 #ifndef APG_RND_H | |
45 #include "rnd.h" | |
46 #endif /* APG_RND_H */ | |
47 | |
48 #define RULE_SIZE (sizeof(rules)/sizeof(struct unit)) | 44 #define RULE_SIZE (sizeof(rules)/sizeof(struct unit)) |
49 #define ALLOWED(flag) (digram[units_in_syllable[current_unit -1]][unit]
& (flag)) | 45 #define ALLOWED(flag) (digram[units_in_syllable[current_unit -1]][unit]
& (flag)) |
50 | 46 |
51 #define MAX_UNACCEPTABLE 20 | 47 #define MAX_UNACCEPTABLE 20 |
52 #define MAX_RETRIES (4 * (int) pwlen + RULE_SIZE) | 48 #define MAX_RETRIES (4 * (int) pwlen + RULE_SIZE) |
53 | 49 |
54 #define NOT_BEGIN_SYLLABLE 010 | 50 #define NOT_BEGIN_SYLLABLE 010 |
55 #define NO_FINAL_SPLIT 04 | 51 #define NO_FINAL_SPLIT 04 |
56 #define VOWEL 02 | 52 #define VOWEL 02 |
57 #define ALTERNATE_VOWEL 01 | 53 #define ALTERNATE_VOWEL 01 |
58 #define NO_SPECIAL_RULE 0 | 54 #define NO_SPECIAL_RULE 0 |
59 | 55 |
60 #define BEGIN 0200 | 56 #define BEGIN 0200 |
61 #define NOT_BEGIN 0100 | 57 #define NOT_BEGIN 0100 |
62 #define BREAK 040 | 58 #define BREAK 040 |
63 #define PREFIX 020 | 59 #define PREFIX 020 |
64 #define ILLEGAL_PAIR 010 | 60 #define ILLEGAL_PAIR 010 |
65 #define SUFFIX 04 | 61 #define SUFFIX 04 |
66 #define END 02 | 62 #define END 02 |
67 #define NOT_END 01 | 63 #define NOT_END 01 |
68 #define ANY_COMBINATION 0 | 64 #define ANY_COMBINATION 0 |
69 | 65 |
70 extern int gen_pron_pass (char *word, char *hyphenated_word, USHORT minlen, | 66 #define S_NB 0x01 /* Numeric */ |
71 USHORT maxlen, unsigned int pass_mode); | 67 #define S_SS 0x02 /* Special */ |
| 68 #define S_CL 0x04 /* Capital */ |
| 69 #define S_SL 0x08 /* Small */ |
| 70 #define S_RS 0x10 /* Restricted Symbol*/ |
72 | 71 |
| 72 extern int gen_pron_pass (char *word, char* hypenated_word, |
| 73 USHORT minlen, USHORT maxlen, unsigned int pass_mode); |
73 USHORT random_unit (USHORT type); | 74 USHORT random_unit (USHORT type); |
74 USHORT get_random (USHORT minlen, USHORT maxlen); | 75 USHORT get_random (USHORT minlen, USHORT maxlen); |
75 boolean have_initial_y (USHORT *units, USHORT unit_size); | 76 boolean have_initial_y (USHORT *units, USHORT unit_size); |
76 boolean illegal_placement (USHORT *units, USHORT pwlen); | 77 boolean illegal_placement (USHORT *units, USHORT pwlen); |
77 boolean improper_word (USHORT *units, USHORT word_size); | 78 boolean improper_word (USHORT *units, USHORT word_size); |
78 boolean have_final_split (USHORT *units, USHORT unit_size); | 79 boolean have_final_split (USHORT *units, USHORT unit_size); |
79 int gen_word (char *word, char *hyphenated_word, USHORT pwlen, | 80 int gen_word (char *word, char *hyphenated_word, USHORT pwlen, unsigned int pass
_mode); |
80 unsigned int pass_mode); | |
81 char *gen_syllable(char *syllable, USHORT pwlen, USHORT *units_in_syllable, | 81 char *gen_syllable(char *syllable, USHORT pwlen, USHORT *units_in_syllable, |
82 USHORT *syllable_length); | 82 USHORT *syllable_length); |
83 | 83 |
84 #endif /* APG_PRONPASS_H */ | 84 #endif /* APG_PRONPASS_H */ |
OLD | NEW |