enc_sha1.c File Reference

#include "module.h"
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  SHA1_CTX

Defines

#define blk(i)
#define blk0(i)   block->l[i]
#define R0(v, w, x, y, z, i)   z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R1(v, w, x, y, z, i)   z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R2(v, w, x, y, z, i)   z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
#define R3(v, w, x, y, z, i)   z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
#define R4(v, w, x, y, z, i)   z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))

Functions

void AnopeFini (void)
int AnopeInit (int argc, char **argv)
int sha1_check_password (const char *plaintext, const char *password)
int sha1_decrypt (const char *src, char *dest, int size)
int sha1_encrypt (const char *src, int len, char *dest, int size)
int sha1_encrypt_check_len (int passlen, int bufsize)
int sha1_encrypt_in_place (char *buf, int size)
void SHA1Final (unsigned char digest[20], SHA1_CTX *context)
void SHA1Init (SHA1_CTX *context)
void SHA1Transform (unsigned long state[5], const unsigned char buffer[64])
void SHA1Update (SHA1_CTX *context, const unsigned char *data, unsigned int len)


Define Documentation

#define blk (  ) 

Value:

(block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
    ^block->l[(i+2)&15]^block->l[i&15],1))

Definition at line 43 of file enc_sha1.c.

#define blk0 (  )     block->l[i]

Definition at line 41 of file enc_sha1.c.

#define R0 ( v,
w,
x,
y,
z,
 )     z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 47 of file enc_sha1.c.

Referenced by SHA1Transform().

#define R1 ( v,
w,
x,
y,
z,
 )     z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 48 of file enc_sha1.c.

Referenced by SHA1Transform().

#define R2 ( v,
w,
x,
y,
z,
 )     z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);

Definition at line 49 of file enc_sha1.c.

Referenced by SHA1Transform().

#define R3 ( v,
w,
x,
y,
z,
 )     z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);

Definition at line 50 of file enc_sha1.c.

Referenced by SHA1Transform().

#define R4 ( v,
w,
x,
y,
z,
 )     z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);

Definition at line 51 of file enc_sha1.c.

Referenced by SHA1Transform().

#define rol ( value,
bits   )     (((value) << (bits)) | ((value) >> (32 - (bits))))

Definition at line 33 of file enc_sha1.c.


Function Documentation

void AnopeFini ( void   ) 

Definition at line 307 of file enc_sha1.c.

References encmodule_check_password(), encmodule_decrypt(), encmodule_encrypt(), encmodule_encrypt_check_len(), and encmodule_encrypt_in_place().

int AnopeInit ( int  argc,
char **  argv 
)

Definition at line 292 of file enc_sha1.c.

References encmodule_check_password(), encmodule_decrypt(), encmodule_encrypt(), encmodule_encrypt_check_len(), encmodule_encrypt_in_place(), ENCRYPTION, MOD_CONT, moduleAddAuthor(), moduleAddVersion(), moduleSetType(), sha1_check_password(), sha1_decrypt(), sha1_encrypt(), sha1_encrypt_check_len(), and sha1_encrypt_in_place().

int sha1_check_password ( const char *  plaintext,
const char *  password 
)

Definition at line 277 of file enc_sha1.c.

References BUFSIZE, and sha1_encrypt().

Referenced by AnopeInit().

int sha1_decrypt ( const char *  src,
char *  dest,
int  size 
)

Definition at line 271 of file enc_sha1.c.

Referenced by AnopeInit().

int sha1_encrypt ( const char *  src,
int  len,
char *  dest,
int  size 
)

Definition at line 221 of file enc_sha1.c.

References alog(), binary_to_hex(), debug, SHA1Final(), SHA1Init(), and SHA1Update().

Referenced by AnopeInit(), sha1_check_password(), and sha1_encrypt_in_place().

int sha1_encrypt_check_len ( int  passlen,
int  bufsize 
)

Definition at line 263 of file enc_sha1.c.

References fatal().

Referenced by AnopeInit().

int sha1_encrypt_in_place ( char *  buf,
int  size 
)

Definition at line 250 of file enc_sha1.c.

References sha1_encrypt().

Referenced by AnopeInit().

void SHA1Final ( unsigned char  digest[20],
SHA1_CTX context 
)

Definition at line 147 of file enc_sha1.c.

References SHA1_CTX::count, SHA1Transform(), and SHA1Update().

Referenced by sha1_encrypt().

void SHA1Init ( SHA1_CTX context  ) 

Definition at line 111 of file enc_sha1.c.

References SHA1_CTX::count, and SHA1_CTX::state.

Referenced by sha1_encrypt().

void SHA1Transform ( unsigned long  state[5],
const unsigned char  buffer[64] 
)

Definition at line 56 of file enc_sha1.c.

References R0, R1, R2, R3, and R4.

Referenced by SHA1Final(), and SHA1Update().

void SHA1Update ( SHA1_CTX context,
const unsigned char *  data,
unsigned int  len 
)

Definition at line 125 of file enc_sha1.c.

References SHA1_CTX::buffer, SHA1_CTX::count, SHA1Transform(), and SHA1_CTX::state.

Referenced by sha1_encrypt(), and SHA1Final().


Generated on Sun Dec 30 09:26:55 2007 for Anope by  doxygen 1.5.1-20070107