Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

md5 in C++

RipZRipZ Posts: 11Member
How can I md5 a string in c++?
In exampel PHP we use md5("my word here"), but how can I do it in C++?

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    : How can I md5 a string in c++?
    : In exampel PHP we use md5("my word here"), but how can I do it in C++?
    :
    :

    what does md5 do? what is the result of your example?

  • DB1DB1 Posts: 1,142Member
    : : How can I md5 a string in c++?
    : : In exampel PHP we use md5("my word here"), but how can I do it in C++?
    : :
    : :
    :
    : what does md5 do? what is the result of your example?
    :
    :

    MD5 is just a hash algorithm used mostly for password transmission over the net. It's almost useless because anyone who can sniff a network packet can just capture and resend the md5'd string to the server just as easily as capturing and resending an unencrypted string.

    Anyway there is no built-in C++ function to hash a stream of data. but you can find some MD5 source all over the net. In windows you can probably #include and use CryptCreateHash() with CALG_MD5 as the ALG_ID then call CryptHashData() to feed the data that needs encrypting. Check MSDN for more info.

    [italic][blue]Programming is like kids... One mistake and you have to support it for life[/blue][/italic]

  • delphifreddelphifred Posts: 1Member
    : MD5 is just a hash algorithm used mostly for password transmission
    : over the net. It's almost useless because anyone who can sniff a
    : network packet can just capture and resend the md5'd string to the
    : server just as easily as capturing and resending an unencrypted
    : string.

    That's why "nonce" is used. To produce an unique hash for each and every request.



  • blacklight332blacklight332 Posts: 1Member
    A lot of people use PHP for md5(), and when they use a C++ implementation it doesn't always return the same hash.

    This implementation's hashes match that of php. I found the [link=http://www.zedwood.com/article/121/cpp-md5-function]c++ md5 function[/link] article on zedwood.
This discussion has been closed.