Dan_track said:
I'm new to c. What I'd like to do is md5 hash a password, but I'm
having problems with the basics. My main problem is I'm wobbly on
knowing where to start from. I assumed I'd use md5.h in my program, but
how do I know what functons to use or exist to be used?
Could somone help me with this?
The md5 libraries are not part of the standard C, so your question
depends on what support is available on the system you are using. If
you're on a Unix system the manual pages are your friend. For example
on my FreeBSD system the command:
$ man 3 md5
gives me the following:
MD5(3) FreeBSD Library Functions Manual
NAME
MD5Init, MD5Update, MD5Pad, MD5Final, MD5End, MD5File, MD5Data --
calculate the RSA Data Security, Inc., ``MD5'' message digest
LIBRARY
Message Digest (MD4, MD5, etc.) Support Library (libmd, -lmd)
SYNOPSIS
#include <sys/types.h>
#include <md5.h>
void
MD5Init(MD5_CTX *context);
void
MD5Update(MD5_CTX *context, const unsigned char *data, unsigned
int len);
void
MD5Pad(MD5_CTX *context);
void
MD5Final(unsigned char digest[16], MD5_CTX *context);
char *
MD5End(MD5_CTX *context, char *buf);
char *
MD5File(const char *filename, char *buf);
char *
MD5Data(const unsigned char *data, unsigned int len, char *buf);
[...]
The MD5Init(), MD5Update(), and MD5Final() functions are the core
functions. Allocate an MD5_CTX, initialize it with MD5Init(), run over
thedata with MD5Update(), and finally extract the result using MD5Final().
Diomidis -
http://www.spinellis.gr