Debian Codegraph @

src/ntproba/markov.h

raw symbols SCIP
1 /*
2 *
3 * Ophcrack is a Lanmanager/NTLM hash cracker based on the faster time-memory
4 * trade-off using rainbow tables.
5 *
6 * Created with the help of: Maxime Mueller, Luca Wullschleger, Claude
7 * Hochreutiner, Andreas Huber and Etienne Dysli.
8 *
9 * Copyright (c) 2013 Philippe Oechslin, Cedric Tissieres,
10 * Bertrand Mesot, Pierre Lestringant
11 *
12 * Ophcrack is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * Ophcrack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with Ophcrack; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * This program is released under the GPL with the additional exemption
27 * that compiling, linking, and/or using OpenSSL is allowed.
28 *
29 *
30 *
31 *
32 */
33 /* WARNING: this file is a NOT copy from implCPU/v6 */
34
35 #ifndef MARKOV_H
36 #define MARKOV_H
37
38 #include <stdint.h>
39
40 #include "aliasMarkovBuffer.h"
41
42 #define ALPHABET_SIZE 26
43 #define MAX_MARKOV_SIZE 12
44
45
46 enum markovType{
47 NO_MARK, MARK0, MARK1, MARK2
48 };
49 typedef enum markovType markovType;
50
51 typedef struct markovImprobaStruct markovImprobaStruct;
52 struct markovImprobaStruct{
53 unsigned int improbaFirst[ALPHABET_SIZE];
54 unsigned int improbaMark0[ALPHABET_SIZE];
55 unsigned int improbaMark1[ALPHABET_SIZE][ALPHABET_SIZE];
56 unsigned int improbaMark2[ALPHABET_SIZE][ALPHABET_SIZE][ALPHABET_SIZE];
57 unsigned int meanImprobaMark0;
58 };
59
60 typedef struct markov0DynProg markov0DynProg;
61 struct markov0DynProg{
62 uint64_t* rootValue;
63 uint64_t* firstLine;
64 uint64_t* buffer;
65 unsigned int minImproba;
66 unsigned int bufferWidth;
67 unsigned int threshold;
68 };
69
70 typedef struct markov1DynProg markov1DynProg;
71 struct markov1DynProg{
72 uint64_t* rootValue;
73 uint64_t* firstLine;
74 uint64_t* buffer[ALPHABET_SIZE];
75 unsigned int minImproba;
76 unsigned int bufferWidth;
77 unsigned int threshold;
78 };
79
80 typedef struct markov2DynProg markov2DynProg;
81 struct markov2DynProg{
82 uint64_t* rootValue;
83 uint64_t* firstLine;
84 uint64_t* buffer[ALPHABET_SIZE][ALPHABET_SIZE];
85 unsigned int minImproba;
86 unsigned int bufferWidth;
87 unsigned int threshold;
88 };
89
90 typedef struct AmarkovDynProg AmarkovDynProg;
91 struct AmarkovDynProg{
92 unsigned int* rootValue;
93 unsigned int* firstLine;
94 unsigned int* buffer;
95 unsigned int minImproba;
96 unsigned int bufferWidth;
97 unsigned int threshold;
98 aliasMarkovBuffer* amb;
99 };
100
101 typedef struct markovDynProgWrapper markovDynProgWrapper;
102 struct markovDynProgWrapper{
103 markovType type;
104
105 markov0DynProg* m0dp;
106 markov1DynProg* m1dp;
107 markov2DynProg* m2dp;
108
109 AmarkovDynProg* amdp;
110 };
111
112 #include "pattern.h"
113
114 void deleteImprobaStruct(markovImprobaStruct* mis);
115
116 int initMarkovDynProgWrapper(markovDynProgWrapper* mdpw, markovImprobaStruct* mis, markovType type);
117 uint64_t getMarkovDynProgRootValue(markovDynProgWrapper* mdpw, markovImprobaStruct* mis, unsigned int requiredLength);
118 void deleteMarkovDynProgWrapper(markovDynProgWrapper* mdpw);
119
120 uint64_t getMarkov0DynProgRootValue(markov0DynProg* m0dp, markovImprobaStruct* mis, unsigned int requiredLength);
121 uint64_t getMarkov0DynProgFirstLine(markov0DynProg* m0dp, markovImprobaStruct* mis, unsigned int index, unsigned int requiredLength);
122 uint64_t getMarkov0DynProgSpace(markov0DynProg* m0dp, markovImprobaStruct* mis, unsigned int length, unsigned int level);
123
124 uint64_t getMarkov1DynProgRootValue(markov1DynProg* m1dp, markovImprobaStruct* mis, unsigned int requiredLength);
125 uint64_t getMarkov1DynProgFirstLine(markov1DynProg* m1dp, markovImprobaStruct* mis, unsigned int index, unsigned int requiredLength);
126 uint64_t getMarkov1DynProgSpace(markov1DynProg* m1dp, markovImprobaStruct* mis, unsigned int length, unsigned int level, unsigned int prevChar);
127
128 uint64_t getMarkov2DynProgRootValue(markov2DynProg* m2dp, markovImprobaStruct* mis, unsigned int requiredLength);
129 uint64_t getMarkov2DynProgFirstLine(markov2DynProg* m2dp, markovImprobaStruct* mis, unsigned int index, unsigned int requiredLength);
130 uint64_t getMarkov2DynProgSpace(markov2DynProg* m2dp, markovImprobaStruct* mis, unsigned int length, unsigned int level, unsigned int prevChar1, unsigned int prevChar2);
131
132 unsigned int getLetterSequenceImprobaMark0(markovImprobaStruct *mis, char* pwd, unsigned int length);
133 unsigned int getLetterSequenceImprobaMark1(markovImprobaStruct *mis, char* pwd, unsigned int length);
134 unsigned int getLetterSequenceImprobaMark2(markovImprobaStruct *mis, char* pwd, unsigned int length);
135
136 #endif