By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,985 Members | 1,712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,985 IT Pros & Developers. It's quick & easy.

How to encrypt a password

P: n/a
Hi

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?

Thanks in advance
Dan

Apr 11 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Dan_track wrote:
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
Apr 11 '06 #2

P: n/a
Hi

Thanks for the reply.

I'm using fedora core 3 linux.

If md5 is not the right the right library can you direct me to the
right one.

Thanks
Dan

Apr 11 '06 #3

P: n/a
Dan_track wrote:
Hi

Thanks for the reply.


Please read in the information in my .sig below.

Brian

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Apr 11 '06 #4

P: n/a
"Dan_track" <da*******@gmail.com> writes:
Thanks for the reply.
What reply? To what?

Read <http://cfaj.freeshell.org/google/>
I'm using fedora core 3 linux.

If md5 is not the right the right library can you direct me to the
right one.


No, at least not in this newsgroup. There is no md5 support in
standard C, which is what we discuss here (though of course md5
algorithms can be implemented in standard C). If your operating
system provides md5 support, you can find out about it by reading your
system's documentation. If that fails, try Google. If *that* fails,
try a more appropriate newsgroup, either comp.unix.programmer or one
of the Linux groups.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 11 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.