Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

MD5 Hash

hello world md5

  • Please log in to reply
32 replies to this topic

#1 Termana

Termana

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 971 posts

Posted 15 December 2008 - 01:27 AM

In this tutorial I will show you how to get an MD5 Hash of a file or a string.

1. Start a new Console Application project in your IDE

2. Download the file I have attached, unzip the files somewhere, and place them in the same folder as your project. Make sure you add them to the projects file list.

3. You will need to include the md5wrapper header:
#include "md5wrapper.h"

4. In your main function, put in this code, I have commented about what things do:
// This will allow us to access the md5wrapper class.
md5wrapper md5;
// This will store the md5 hash of a file called test.txt in a string hash1
std::string hash1 = md5.getHashFromFile("test.txt");
// This will store the md5 hash of some text into a string hash2
std::string hash2 = md5.getHashFromString("Hello World");
// This will print, the hash from the file and from the string
std::cout << hash1 << std::endl; << hash2 std::endl;
system("PAUSE"); // Remove if your using Linux.
return 0;

5. Edit the above code to make it do what you want, I have tried to make it as obvious as to how you can use it properly.

6. Enjoy. And +rep me :P lol

Attached Files

  • Attached File  md5.zip   6.03KB   3839 downloads

  • 2

Interested in participating in community events?
Want to harness your programming skill and turn it into absolute prowess?
Come join our programming events!


#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 15 December 2008 - 04:25 AM

Can you offer some commentary on how the MD5 code works and what it does?
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#3 OrhanC1

OrhanC1

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 26 December 2008 - 09:33 PM

Can you offer some commentary on how the MD5 code works and what it does?


Hi! I don't mean to come across as rude and I'm genuinely asking this as a question i would like answered but could you not just read the header?
  • 0

#4 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 27 December 2008 - 06:59 AM

Having implemented a modified MD5 hash, I know what it does, but would like to see someone explain it.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#5 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 27 December 2008 - 12:42 PM

It's a shame you are using inbuilt functions instead of using your own algorithm. But what the heck, +rep.
  • -1
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#6 Monkeyjoe

Monkeyjoe

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 23 January 2009 - 03:26 PM

Thanks
  • 0

#7 Kennylap

Kennylap

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 24 January 2009 - 12:06 AM

Oh! Thanks, i'm searching for this for sometime..
Really appreciated ;)
  • 0

#8 Phoenixz

Phoenixz

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 222 posts

Posted 24 January 2009 - 08:07 AM

Edit: NVM I think I got it now, but what practical uses are there for this, may you explain? :)

Edited by Phoenixz, 24 January 2009 - 10:41 AM.

  • 0
Posted Image

#9 k3n

k3n

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 February 2009 - 11:37 AM

thanks a lot
  • 0

#10 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 08 February 2009 - 12:57 PM

So what does your code do?

You didn't really explain what it does? What does the md5 function do?

Why do we need access to the md5wrapper?
  • 0

#11 Mr_Dark

Mr_Dark

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 17 February 2009 - 09:51 AM

Nice class, helped my a lot.
  • 0

#12 Thundergod

Thundergod

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 23 February 2009 - 02:55 PM

Nice, ty.
  • 0





Also tagged with one or more of these keywords: hello world, md5

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download