File: random.h

package info (click to toggle)
medussa 0.8-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,004 kB
  • ctags: 1,156
  • sloc: ansic: 9,049; sh: 3,319; makefile: 113
file content (66 lines) | stat: -rw-r--r-- 1,841 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * medussa - a distributed cracking system
 * Copyright (C) 1999 Kostas Evangelinos <kos@bastard.net>
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 */

/*
 * $Id: random.h,v 1.3 2003/02/05 04:38:37 kos Exp $
 *
 */

#ifndef _RANDOM_H
#define _RANDOM_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <limits.h>
#include <openssl/md5.h>

#include "keyspace.h"
#include "generator.h"

#define RNG_MAX_LENGTH MD5_DIGEST_LENGTH
#define RNG_DEF_SEED "BURGERKINGNG"
#define RNG_DEF_LENGTH 4
#define RNG_MAXRES ULONG_MAX
#define RNG_MINRES 0

typedef struct random_t {
  unsigned char seed[RNG_MAX_LENGTH];
  unsigned char x_n[RNG_MAX_LENGTH];
  key_index_t index;
  key_index_t minindex;
  key_index_t maxindex;
  int len;
} random_t;

random_t *random_init(char *params);
int random_set(random_t *, key_index_t index);
int random_fetch(random_t *, kchar *buf, int len, int *rlen);
int random_done(random_t *);
int random_destroy(random_t *);
key_index_t *random_minindex(random_t *);
key_index_t *random_maxindex(random_t *);
key_index_t *random_curindex(random_t *);
int random_minlen(random_t *);
int random_maxlen(random_t *);

#endif /* _RANDOM_H */