cipher.h 1.18 KB
/* blowfish.h ***************************************************
   
                               Anubis
                    Blowfish encrytion algorithm

****************************************************************/

#ifndef __CIPHER_H__
#define __CIPHER_H__

typedef unsigned int u32; 
typedef unsigned char byte; 


/* blowfish */ 
typedef struct {
    u32 s0[256];
    u32 s1[256];
    u32 s2[256];
    u32 s3[256];
    u32 p[18];
} BLOWFISH_context;

#ifdef __cplusplus
extern "C" {
#endif
int  bf_setkey( BLOWFISH_context *c, byte *key, unsigned keylen );
void encrypt_block( BLOWFISH_context *bc, byte *outbuf, byte *inbuf );
void decrypt_block( BLOWFISH_context *bc, byte *outbuf, byte *inbuf );


/* sha1 */ 
char *ascii_sha1(char *, int n);   /* returns (a pointer to) a 40 characters asciiz string */ 
byte *sha1(char *, int n);         /* returns (a pointer to) an array of 20 bytes */ 

int same_sha1(byte *, byte *); 
char hex_digit(byte); 
char *sha1_to_ascii(byte *); 

/* blowfish */ 
u32  blowfish_decrypt_text(byte *key, byte *text, u32 text_len); 
void blowfish_encrypt_padded_text(byte *key, byte *text, u32 length_of_text_before_padding); 

      
#ifdef __cplusplus
}
#endif

#endif