aboutsummaryrefslogtreecommitdiffstats
path: root/lib/md5.h
blob: 094507b275336fe969d2fdbde5599075684b0a71 (plain)
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
/*
 * MD5 hashing code copied from Lepton's crack <http://usuarios.lycos.es/reinob/>
 *
 * Adapted to be API-compatible with the previous (GPL-incompatible) code.
 */

/*
 * This code implements the MD5 message-digest algorithm.
 * The algorithm is due to Ron Rivest.  This code was
 * written by Colin Plumb in 1993, no copyright is claimed.
 * This code is in the public domain; do with it what you wish.
 *
 * Equivalent code is available from RSA Data Security, Inc.
 * This code has been tested against that, and is equivalent,
 * except that you don't need to include two pages of legalese
 * with every copy.
 *
 * To compute the message digest of a chunk of bytes, declare an
 * MD5Context structure, pass it to MD5Init, call MD5Update as
 * needed on buffers full of bytes, and then call MD5Final, which
 * will fill a supplied 16-byte array with the digest.
 */

#ifndef _MD5_H
#define _MD5_H

#include <sys/types.h>
#include <gmodule.h>
#include <stdint.h>

typedef uint8_t md5_byte_t;
typedef struct MD5Context {
	uint32_t buf[4];
	uint32_t bits[2];
	unsigned char in[64];
} md5_state_t;

G_MODULE_EXPORT void md5_init(struct MD5Context *context);
G_MODULE_EXPORT void md5_append(struct MD5Context *context, const md5_byte_t *buf, unsigned int len);
G_MODULE_EXPORT void md5_finish(struct MD5Context *context, md5_byte_t digest[16]);

#endif
class="o">*s ); G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec ); double gettime( void ); G_MODULE_EXPORT void strip_html( char *msg ); G_MODULE_EXPORT char *escape_html( const char *html ); G_MODULE_EXPORT void http_decode( char *s ); G_MODULE_EXPORT void http_encode( char *s ); G_MODULE_EXPORT char *ipv6_wrap( char *src ); G_MODULE_EXPORT char *ipv6_unwrap( char *src ); G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ); G_MODULE_EXPORT void random_bytes( unsigned char *buf, int count ); G_MODULE_EXPORT int is_bool( char *value ); G_MODULE_EXPORT int bool2int( char *value ); G_MODULE_EXPORT struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain ); G_MODULE_EXPORT char *word_wrap( char *msg, int line_len ); G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl ); #endif