How to encrypt a password

Discussion in 'C Programming' started by Dan_track, Apr 11, 2006.

  1. Dan_track

    Dan_track Guest

    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
     
    Dan_track, Apr 11, 2006
    #1
    1. Advertising

  2. 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
     
    Diomidis Spinellis, Apr 11, 2006
    #2
    1. Advertising

  3. Dan_track

    Dan_track Guest

    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
     
    Dan_track, Apr 11, 2006
    #3
  4. Dan_track

    Default User Guest

    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.
     
    Default User, Apr 11, 2006
    #4
  5. "Dan_track" <> 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) <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.
     
    Keith Thompson, Apr 11, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand

    Encrypt identity password

    Anand, Jul 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    559
  2. Henry
    Replies:
    3
    Views:
    24,173
    Henry
    Aug 4, 2004
  3. AAaron123
    Replies:
    2
    Views:
    2,378
    AAaron123
    Jan 16, 2009
  4. AAaron123
    Replies:
    1
    Views:
    1,427
    Oriane
    Jan 16, 2009
  5. http://ejobseek.com

    Encrypt in Perl, De-encrypt in Javascript

    http://ejobseek.com, Sep 1, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    316
    James Willmore
    Sep 1, 2003
Loading...

Share This Page