+ Reply to Thread
Page 1 of 3
1 2 3 LastLast
Results 1 to 10 of 30

Thread: MD5 Hash

  1. #1
    Code Warrior Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana's Avatar
    Join Date
    Oct 2008
    Posts
    4,055
    Blog Entries
    6

    MD5 Hash

    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:
    Code:
    #include "md5wrapper.h"
    4. In your main function, put in this code, I have commented about what things do:
    Code:
    // 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 lol
    Attached Files
    My Site | Questions and Answers | Ask Me: Termana | Last Tutorial: Ajax innerHTML
    If you can keep your head while all around you are losing theirs, you probably have a CD writer on your desktop

  2. #2
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,673
    Blog Entries
    57

    Re: MD5 Hash

    Can you offer some commentary on how the MD5 code works and what it does?
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  3. #3
    Newbie OrhanC1 is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    3

    Re: MD5 Hash

    Quote Originally Posted by WingedPanther View Post
    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?

  4. #4
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,673
    Blog Entries
    57

    Re: MD5 Hash

    Having implemented a modified MD5 hash, I know what it does, but would like to see someone explain it.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #5
    Xav
    Xav is offline
    Code Slinger Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav's Avatar
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,210
    Blog Entries
    13

    Re: MD5 Hash

    It's a shame you are using inbuilt functions instead of using your own algorithm. But what the heck, +rep.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  6. #6
    Newbie Monkeyjoe is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    1

    Re: MD5 Hash

    Thanks

  7. #7
    Newbie Kennylap is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    1

    Re: MD5 Hash

    Oh! Thanks, i'm searching for this for sometime..
    Really appreciated

  8. #8
    Programming Professional Phoenixz will become famous soon enough
    Join Date
    Dec 2008
    Posts
    252
    Blog Entries
    1

    Re: MD5 Hash

    Edit: NVM I think I got it now, but what practical uses are there for this, may you explain?
    Last edited by Phoenixz; 01-24-2009 at 12:41 PM.

  9. #9
    k3n
    k3n is offline
    Newbie k3n is an unknown quantity at this point
    Join Date
    Feb 2009
    Posts
    1

    Re: MD5 Hash

    thanks a lot

  10. #10
    Code Slinger chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5 has a reputation beyond repute chili5's Avatar
    Join Date
    Mar 2008
    Posts
    7,023
    Blog Entries
    1

    Re: MD5 Hash

    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?
    "Whenever you remember, I'll be there/
    Remember how we reached that dream together" - Carrie Underwood

+ Reply to Thread
Page 1 of 3
1 2 3 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 0
    Last Post: 10-29-2008, 10:00 PM
  2. Coder Battle #1: Hash Algorithm
    By Jordan in forum Games
    Replies: 74
    Last Post: 10-13-2008, 08:17 AM
  3. Replies: 3
    Last Post: 08-25-2008, 11:20 PM
  4. Password hash
    By im-not-alive in forum Database & Database Programming
    Replies: 8
    Last Post: 12-28-2007, 01:49 PM
  5. Replies: 0
    Last Post: 11-28-2007, 06:49 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts