anybody knows a GOOD Platform Independent EASY TO USE C++ md5 librery
anybody knows a GOOD Platform Independent EASY TO USE C++ md5 librery
Are you asking in relation to http://cboard.cprogramming.com/showthread.php?t=105493
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Nope Thats a C lib not C++ and That one I've got for C++ is not good at all.
It was messing the header files names and lots of C code in C++ which refuses to compile due bad structure.
as I am not getting any C++ lib I am trying to understand this C one which atleast compiles.
However I dont want to use any lib that user need to install to get a DLL or so which will will be dynamically linked.
I want a C++ Code that I can statically Compile with my programm.
Thats why I cant simply use mhash cause its hard to extract the md5() code from it.
Last edited by noobcpp; 07-22-2008 at 11:53 PM.
Perhaps wrap the C code in a C++ class of your own.
Sooner or later, you'll want to do this yourself, so consider this an opportunity to learn.
It's not like MD5 has a complicated interface or anything.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
anyway but I've made that semi broken C++ implementation working by borrowing some codes from the C version.
hashlib++ seems to work OK, too.
Could someone please show some sample code that I could run using hashlib++(or a similar hashing function that uses MD5)?
I am very new to programming!
Thanks
Download the hashlib++ library; there are examples contained in the package.
Thank you for your help, but when I run md5example.cpp I get many errors such as:
md5example.cpp:1:23: hashlibpp.h: No such file or directory
md5example.cpp:8: error: expected constructor, destructor, or type conversion before '*' token
md5example.cpp:8: error: expected `,' or `;' before '*' token
md5example.cpp:10: error: expected unqualified-id before "try"
md5example.cpp:10: error: expected `,' or `;' before "try"
md5example.cpp:22: error: expected unqualified-id before "catch"
md5example.cpp:22: error: expected `,' or `;' before "catch"
md5example.cpp:32: error: expected unqualified-id before "delete"
md5example.cpp:32: error: expected `,' or `;' before "delete"
Any ideas??
Thanks!
Don't delete hashlibpp.h before you start? (Or, alternatively, put in the directory along with everything else, or make sure you download it in the first place.)
I did think it was very odd for me to get an error saying "md5example.cpp:1:23: hashlibpp.h: No such file or directory"
I changed the top of the code to
That problem is gone, however I now get:Code:#include <string.h> #include <iostream.h> //for "cerr" include "hashlibpp.h"
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31,
from md5example.cpp:2:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
md5example.cpp:8: error: expected constructor, destructor, or type conversion before string constant
md5example.cpp:8: error: expected `,' or `;' before string constant
md5example.cpp:10: error: expected unqualified-id before "try"
md5example.cpp:10: error: expected `,' or `;' before "try"
md5example.cpp:22: error: expected unqualified-id before "catch"
md5example.cpp:22: error: expected `,' or `;' before "catch"
md5example.cpp:32: error: expected unqualified-id before "delete"
md5example.cpp:32: error: expected `,' or `;' before "delete"
I don't understand!!
Using iostream.h is evil and a sin. The header is called <iostream>, no .h at the end.
ETA: Also, I don't believe the rest of the error messages, because although you added two lines to the source code (as noted from the error message on line 2), the other errors did not move down two lines. And you did do #include, not just include, right?
Last edited by tabstop; 07-29-2008 at 06:17 PM.
Thanks for the tips. The following code:
Code:#include <string.h> #include <iostream> //for "cerr" #include "hashlibpp.h"
generates the following error messages:
In file included from md5example.cpp:3:
hashlibpp.h:43:28: hl_hashwrapper.h: No such file or directory
hashlibpp.h:44:27: hl_md5wrapper.h: No such file or directory
hashlibpp.h:45:28: hl_sha1wrapper.h: No such file or directory
hashlibpp.h:46:30: hl_sha256wrapper.h: No such file or directory
hashlibpp.h:47:30: hl_sha384wrapper.h: No such file or directory
hashlibpp.h:48:30: hl_sha512wrapper.h: No such file or directory
md5example.cpp:8: error: expected constructor, destructor, or type conversion before '*' token
md5example.cpp:8: error: expected `,' or `;' before '*' token
md5example.cpp:10: error: expected unqualified-id before "try"
md5example.cpp:10: error: expected `,' or `;' before "try"
md5example.cpp:22: error: expected unqualified-id before "catch"
md5example.cpp:22: error: expected `,' or `;' before "catch"
md5example.cpp:32: error: expected unqualified-id before "delete"
md5example.cpp:32: error: expected `,' or `;' before "delete"
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
When I try to run their suggested quote, I get:
/cygdrive/c/DOCUME~1/mehrdad/LOCALS~1/Temp/ccpcV0op.o:myMD5.cpp.text+0x79): undefined reference to `md5wrapper::md5wrapper()'
/cygdrive/c/DOCUME~1/mehrdad/LOCALS~1/Temp/ccpcV0op.o:myMD5.cpp.text+0xd7): undefined reference to `md5wrapper::getHashFromString(std::basic_string<c har, std::char_traits<char>, std::allocator<char> >)'
/cygdrive/c/DOCUME~1/mehrdad/LOCALS~1/Temp/ccpcV0op.o:myMD5.cpp.text+0x1b3): undefined reference to `md5wrapper::getHashFromFile(std::basic_string<cha r, std::char_traits<char>, std::allocator<char> >)'
/cygdrive/c/DOCUME~1/mehrdad/LOCALS~1/Temp/ccpcV0op.o:myMD5.cpp.text+0x2c8): undefined reference to `md5wrapper::~md5wrapper()'
/cygdrive/c/DOCUME~1/mehrdad/LOCALS~1/Temp/ccpcV0op.o:myMD5.cpp.text+0x322): undefined reference to `md5wrapper::~md5wrapper()'
collect2: ld returned 1 exit status