cipher.h
1.18 KB
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
/* 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