Anope IRC Services  Version 1.8
Data Structures | Macros | Typedefs | Functions | Variables
enc_md5.c File Reference
#include "module.h"
#include <string.h>
Include dependency graph for enc_md5.c:

Go to the source code of this file.

Data Structures

struct  MD5_CTX
 

Macros

#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 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

void Ano_MD5Transform (UINT4[4], unsigned char[64])
 
static void Encode (unsigned char *, UINT4 *, unsigned int)
 
static void Decode (UINT4 *, unsigned char *, unsigned int)
 
void Ano_MD5Init (MD5_CTX *context)
 
void Ano_MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen)
 
void Ano_MD5Final (digest, MD5_CTX *context)
 
void Ano_MD5Transform (state, block)
 
static int md5_encrypt (const char *src, int len, char *dest, int size)
 
static int md5_encrypt_check_len (int passlen, int bufsize)
 
static int md5_decrypt (const char *src, char *dest, int size)
 
static int md5_check_password (const char *plaintext, const char *password)
 
int AnopeInit (int argc, char **argv)
 
void AnopeFini (void)
 

Variables

static unsigned char PADDING [64]
 

Macro Definition Documentation

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

Definition at line 88 of file enc_md5.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); \
}
#define F(x, y, z)
Definition: enc_md5.c:88
unsigned int UINT4
Definition: enc_md5.c:43
Command * c
Definition: ns_recover.c:17
#define ROTATE_LEFT(x, n)
Definition: enc_md5.c:95

Definition at line 100 of file enc_md5.c.

Referenced by Ano_MD5Transform().

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

Definition at line 89 of file enc_md5.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); \
}
#define G(x, y, z)
Definition: enc_md5.c:89
unsigned int UINT4
Definition: enc_md5.c:43
Command * c
Definition: ns_recover.c:17
#define ROTATE_LEFT(x, n)
Definition: enc_md5.c:95

Definition at line 105 of file enc_md5.c.

Referenced by Ano_MD5Transform().

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

Definition at line 90 of file enc_md5.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); \
}
unsigned int UINT4
Definition: enc_md5.c:43
#define H(x, y, z)
Definition: enc_md5.c:90
Command * c
Definition: ns_recover.c:17
#define ROTATE_LEFT(x, n)
Definition: enc_md5.c:95

Definition at line 110 of file enc_md5.c.

Referenced by Ano_MD5Transform().

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

Definition at line 91 of file enc_md5.c.

#define II (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define I(x, y, z)
Definition: enc_md5.c:91
unsigned int UINT4
Definition: enc_md5.c:43
Command * c
Definition: ns_recover.c:17
#define ROTATE_LEFT(x, n)
Definition: enc_md5.c:95

Definition at line 115 of file enc_md5.c.

Referenced by Ano_MD5Transform().

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

Definition at line 95 of file enc_md5.c.

#define S11   7

Definition at line 59 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S12   12

Definition at line 60 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S13   17

Definition at line 61 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S14   22

Definition at line 62 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S21   5

Definition at line 63 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S22   9

Definition at line 64 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S23   14

Definition at line 65 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S24   20

Definition at line 66 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S31   4

Definition at line 67 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S32   11

Definition at line 68 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S33   16

Definition at line 69 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S34   23

Definition at line 70 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S41   6

Definition at line 71 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S42   10

Definition at line 72 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S43   15

Definition at line 73 of file enc_md5.c.

Referenced by Ano_MD5Transform().

#define S44   21

Definition at line 74 of file enc_md5.c.

Referenced by Ano_MD5Transform().

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

Definition at line 336 of file enc_md5.c.

Typedef Documentation

typedef void* POINTER

Definition at line 55 of file enc_md5.c.

typedef unsigned int UINT4

Definition at line 43 of file enc_md5.c.

Function Documentation

void Ano_MD5Final ( digest  ,
MD5_CTX context 
)

Definition at line 181 of file enc_md5.c.

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

Referenced by md5_encrypt().

void Ano_MD5Init ( MD5_CTX context)

Definition at line 123 of file enc_md5.c.

References MD5_CTX::count.

Referenced by md5_encrypt().

void Ano_MD5Transform ( UINT4  [4],
unsigned  char[64] 
)

Referenced by Ano_MD5Update().

void Ano_MD5Transform ( state  ,
block   
)

Definition at line 209 of file enc_md5.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.

void Ano_MD5Update ( MD5_CTX context,
unsigned char *  input,
unsigned int  inputLen 
)

Definition at line 139 of file enc_md5.c.

References Ano_MD5Transform(), and MD5_CTX::count.

Referenced by Ano_MD5Final(), and md5_encrypt().

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

Definition at line 320 of file enc_md5.c.

Referenced by Ano_MD5Transform().

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

Definition at line 302 of file enc_md5.c.

Referenced by Ano_MD5Final().

static int md5_check_password ( const char *  plaintext,
const char *  password 
)
static

Definition at line 379 of file enc_md5.c.

References BUFSIZE, and md5_encrypt().

Referenced by AnopeInit().

static int md5_decrypt ( const char *  src,
char *  dest,
int  size 
)
static

Definition at line 373 of file enc_md5.c.

Referenced by AnopeInit().

static int md5_encrypt ( const char *  src,
int  len,
char *  dest,
int  size 
)
static

Definition at line 338 of file enc_md5.c.

References alog(), Ano_MD5Final(), Ano_MD5Init(), Ano_MD5Update(), binary_to_hex(), and debug.

Referenced by AnopeInit(), and md5_check_password().

static int md5_encrypt_check_len ( int  passlen,
int  bufsize 
)
static

Definition at line 365 of file enc_md5.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 80 of file enc_md5.c.

Referenced by Ano_MD5Final().