Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Are there any ready to use MD5 C-function in Linux?

Reply
Thread Tools

Re: Are there any ready to use MD5 C-function in Linux?

 
 
Abby
Guest
Posts: n/a
 
      08-20-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Tom Naxos) wrote in message news:<(E-Mail Removed) om>...
> (E-Mail Removed) (Abby) wrote in message news:<(E-Mail Removed) om>...
> > I'm doing C programming which require MD5 algorithm. I have a string
> > which needed to be hashed using MD5, but I have no idea how to do it.
> > I've read RFC 1321, but it's way over my head ... anybody know if
> > there're any ready-to-use function or other easier way to achive this?
> > Please let me know. Thank you so much.

>
> the sources of the openssl crypto library contain a nice md5 implementation in C.
> And other crypto oder hash algorithms as well.
>
> http://www.openssl.org/source/


I use the following code, but it doesn't work.

#include <stdio.h>
#include <string.h>
#include <openssl/md5.h>

int main(){

char password[20] = "password";
MD5_CTX context;
int i;
unsigned char digest[16];
unsigned int len = strlen (password);

MD5_Init(&context);
MD5_Update (&context, password, len);
MD5_Final(digest, &context);

printf ("MD5(\"%s\") = ", password);
for (i = 0; i < 16; i++) {
printf ("%02x", digest[i]);
}
printf ("\n");
return 0;
}


When I compiled this code, it generate error said
[Linker error] undefined reference to `_MD5_Init'
[Linker error] undefined reference to `_MD5_Update'
[Linker error] undefined reference to `_MD5_Final'

I'm not sure if I'm doing the right way. Please recommend.
 
Reply With Quote
 
 
 
 
Anton Stiglic
Guest
Posts: n/a
 
      08-20-2003

> When I compiled this code, it generate error said
> [Linker error] undefined reference to `_MD5_Init'
> [Linker error] undefined reference to `_MD5_Update'
> [Linker error] undefined reference to `_MD5_Final'
>
> I'm not sure if I'm doing the right way. Please recommend.



It's probably the way you are compiling that is not correct. You are
probably not linking to the openssl library correctly...

With gcc, I have so that I just need to do
gcc ...... -lcrypto
to link to the openssl library.

--Anton


 
Reply With Quote
 
 
 
 
Derk Gwen
Guest
Posts: n/a
 
      08-21-2003
(E-Mail Removed) (Abby) wrote:

# When I compiled this code, it generate error said
# [Linker error] undefined reference to `_MD5_Init'
# [Linker error] undefined reference to `_MD5_Update'
# [Linker error] undefined reference to `_MD5_Final'

http://derkgwen.250free.com/html/rsa-mdv.html

has the entire RSA donated code available.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
You face forward, or you face the possibility of shock and damage.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a md5 / md5 passwd with a salt Peter Woodsky Ruby 6 11-21-2008 09:08 AM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
md5 from python different then md5 from command line ursache.marius@gmail.com Python 9 05-07-2006 11:49 PM
I remember someone asking about an MD5 javascript: http://pajhome.org.uk/crypt/md5/ Mozzie \( v \) Javascript 0 07-12-2004 01:06 PM
Asterisk ...are there system houses that sell ready made systems? hello_r VOIP 3 08-08-2003 06:17 PM



Advertisments