[질문]MD5 알고리즘 인코딩

b79jini의 이미지

제가 지금 통신 프로그램을 하나 만들고 있는데
비밀 번호를 MD5 방식으로 인코딩해서 나온 결과를 서버에 전송해야 합니다.

특정 문자를 MD5 알고리즘으로 인코딩 하려면 어떻게 해야하나요??

고물의 이미지

man md5

b79jini의 이미지

man md5 해서 찾은 내용에 따라서

#include <openssl/md5.h> 포함하고

main에서

char lsBuff[] = "abc";
unsigned char lucpMD5[16];
unsigned long lulLen = strlen(lsBuff);
int li;
MD5_CTX lmdContext;

MD5_Init(&lmdContext);
MD5_Updata(&lmdContext,lsBuff,lulLen);
MD5_Final(lucpMD5, &lmdContext);

printf("MD5 %s \n ",lsBuff);

for(li=0;li<16;li++)
printf("%02x",lucpMD5[li]);

이렇게 프로그램 했습니다.
제대로 바꿔지는지 확인 하고 싶어서...
그랬는데 컴파일 하니깐

/tmp/ccgVUvCl.o(.text+0x3e) undefined reference to `MD5_Init'
/tmp/ccgVUvCl.o(.text+0x58) undefined reference to `MD5_Updata'
/tmp/ccgVUvCl.o(.text+0x6e) undefined reference to `MD5_Final'

이런 에러 문장이 뜨는데 해당 reference가 없다는 거죠???
어떻게 해결해야 하는지 좀 알려주세요

purewell의 이미지

컴파일 옵션에 -lssl 해보세요.
_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz

_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz

dyaus의 이미지

openssl 링크를 빼먹은것 같습니다.

openssl 관련 library 가 설치되어 있는지 확인하시고.

-lssl 을 포함하시면 될 것 같은데요.

purewell의 이미지

컴파일할 때 -lssl 옵션을 추가해서 컴파일해보세요.

표준라이브러리가 아니기 때문에 직접 써넣어줘야합니다.

_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz

jj의 이미지

해쉬데이터에 비밀번호와 랜덤한 요소가 같이 안들어가면, 해쉬값이 아무 소용없다는거 유의하시길...

핫... 다아시는거죠? :)

--
Life is short. damn short...

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.