Data Structures | Defines | Typedefs | Functions | Variables

enc_old.c File Reference

#include "module.h"
#include <string.h>
Include dependency graph for enc_old.c:

Go to the source code of this file.

Data Structures

struct  MD5_CTX

Defines

#define S11   7
#define S12   12
#define S13   17
#define S14   22
#define S21   5
#define S22   9
#define S23   14
#define S24   20
#define S31   4
#define S32   11
#define S33   16
#define S34   23
#define S41   6
#define S42   10
#define S43   15
#define S44   21
#define F(x, y, z)   (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z)   (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z)   ((x) ^ (y) ^ (z))
#define MD5_I(x, y, z)   ((y) ^ ((x) | (~z)))
#define ROTATE_LEFT(x, n)   (((x) << (n)) | ((x) >> (32-(n))))
#define FF(a, b, c, d, x, s, ac)
#define GG(a, b, c, d, x, s, ac)
#define HH(a, b, c, d, x, s, ac)
#define II(a, b, c, d, x, s, ac)
#define XTOI(c)   ((c)>9 ? (c)-'A'+10 : (c)-'0')

Typedefs

typedef unsigned int UINT4
typedef void * POINTER

Functions

static void my_binary_to_hex (unsigned char *bin, char *hex, int length)
static void MD5Transform (UINT4[4], unsigned char[64])
static void Encode (unsigned char *, UINT4 *, unsigned int)
static void Decode (UINT4 *, unsigned char *, unsigned int)
static void MD5Init (MD5_CTX *context)
static void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen)
static void MD5Final (digest, MD5_CTX *context)
static void MD5Transform (state, block)
static int old_encrypt (const char *src, int len, char *dest, int size)
static int old_encrypt_check_len (int passlen, int bufsize)
static int old_check_password (const char *plaintext, const char *password)
static int old_decrypt (const char *src, char *dest, int size)
int AnopeInit (int argc, char **argv)
void AnopeFini (void)

Variables

static unsigned char PADDING [64]

Define Documentation

#define F (   x,
  y,
  z 
)    (((x) & (y)) | ((~x) & (z)))

Definition at line 105 of file enc_old.c.

#define FF (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
 (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 117 of file enc_old.c.

Referenced by MD5Transform().

#define G (   x,
  y,
  z 
)    (((x) & (z)) | ((y) & (~z)))

Definition at line 106 of file enc_old.c.

#define GG (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
 (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 122 of file enc_old.c.

Referenced by MD5Transform().

#define H (   x,
  y,
  z 
)    ((x) ^ (y) ^ (z))

Definition at line 107 of file enc_old.c.

#define HH (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
 (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 127 of file enc_old.c.

Referenced by MD5Transform().

#define II (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
 (a) += MD5_I ((b), (c), (d)) + (x) + (UINT4)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 132 of file enc_old.c.

Referenced by MD5Transform().

#define MD5_I (   x,
  y,
  z 
)    ((y) ^ ((x) | (~z)))

Definition at line 108 of file enc_old.c.

#define ROTATE_LEFT (   x,
  n 
)    (((x) << (n)) | ((x) >> (32-(n))))

Definition at line 112 of file enc_old.c.

#define S11   7

Definition at line 76 of file enc_old.c.

Referenced by MD5Transform().

#define S12   12

Definition at line 77 of file enc_old.c.

Referenced by MD5Transform().

#define S13   17

Definition at line 78 of file enc_old.c.

Referenced by MD5Transform().

#define S14   22

Definition at line 79 of file enc_old.c.

Referenced by MD5Transform().

#define S21   5

Definition at line 80 of file enc_old.c.

Referenced by MD5Transform().

#define S22   9

Definition at line 81 of file enc_old.c.

Referenced by MD5Transform().

#define S23   14

Definition at line 82 of file enc_old.c.

Referenced by MD5Transform().

#define S24   20

Definition at line 83 of file enc_old.c.

Referenced by MD5Transform().

#define S31   4

Definition at line 84 of file enc_old.c.

Referenced by MD5Transform().

#define S32   11

Definition at line 85 of file enc_old.c.

Referenced by MD5Transform().

#define S33   16

Definition at line 86 of file enc_old.c.

Referenced by MD5Transform().

#define S34   23

Definition at line 87 of file enc_old.c.

Referenced by MD5Transform().

#define S41   6

Definition at line 88 of file enc_old.c.

Referenced by MD5Transform().

#define S42   10

Definition at line 89 of file enc_old.c.

Referenced by MD5Transform().

#define S43   15

Definition at line 90 of file enc_old.c.

Referenced by MD5Transform().

#define S44   21

Definition at line 91 of file enc_old.c.

Referenced by MD5Transform().

#define XTOI (   c  )     ((c)>9 ? (c)-'A'+10 : (c)-'0')

Definition at line 354 of file enc_old.c.

Referenced by old_encrypt().


Typedef Documentation

typedef void* POINTER

Definition at line 72 of file enc_old.c.

typedef unsigned int UINT4

Definition at line 60 of file enc_old.c.


Function Documentation

void AnopeFini ( void   ) 
int AnopeInit ( int  argc,
char **  argv 
)
static void Decode ( UINT4 output,
unsigned char *  input,
unsigned int  len 
) [static]

Definition at line 336 of file enc_old.c.

Referenced by MD5Transform().

static void Encode ( unsigned char *  output,
UINT4 input,
unsigned int  len 
) [static]

Definition at line 318 of file enc_old.c.

Referenced by MD5Final().

static void MD5Final ( digest  ,
MD5_CTX context 
) [static]

Definition at line 197 of file enc_old.c.

References MD5_CTX::count, Encode(), MD5Update(), PADDING, and MD5_CTX::state.

Referenced by old_encrypt().

static void MD5Init ( MD5_CTX context  )  [static]

Definition at line 140 of file enc_old.c.

Referenced by old_encrypt().

static void MD5Transform ( state  ,
block   
) [static]

Definition at line 225 of file enc_old.c.

References c, Decode(), FF, GG, HH, II, S11, S12, S13, S14, S21, S22, S23, S24, S31, S32, S33, S34, S41, S42, S43, and S44.

static void MD5Transform ( UINT4  [4],
unsigned  char[64] 
) [static]

Referenced by MD5Update().

static void MD5Update ( MD5_CTX context,
unsigned char *  input,
unsigned int  inputLen 
) [static]

Definition at line 156 of file enc_old.c.

References MD5Transform().

Referenced by MD5Final(), and old_encrypt().

static void my_binary_to_hex ( unsigned char *  bin,
char *  hex,
int  length 
) [static]

Definition at line 16 of file enc_old.c.

Referenced by old_encrypt().

static int old_check_password ( const char *  plaintext,
const char *  password 
) [static]

Definition at line 402 of file enc_old.c.

References old_encrypt().

Referenced by AnopeInit().

static int old_decrypt ( const char *  src,
char *  dest,
int  size 
) [static]

Definition at line 414 of file enc_old.c.

Referenced by AnopeInit().

static int old_encrypt ( const char *  src,
int  len,
char *  dest,
int  size 
) [static]

Definition at line 361 of file enc_old.c.

References alog(), debug, MD5Final(), MD5Init(), MD5Update(), my_binary_to_hex(), and XTOI.

Referenced by AnopeInit(), and old_check_password().

static int old_encrypt_check_len ( int  passlen,
int  bufsize 
) [static]

Definition at line 391 of file enc_old.c.

References fatal().

Referenced by AnopeInit().


Variable Documentation

unsigned char PADDING[64] [static]
Initial value:
 {
    0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 97 of file enc_old.c.

Referenced by MD5Final().