none
Help with MD5 RRS feed

  • Question

  • Im using a service where i need to send an MD5 algorithm (a hexadecimal value, 32 characters long).

    Im using this code https://blogs.msdn.microsoft.com/csharpfaq/2006/10/09/how-do-i-calculate-a-md5-hash-from-a-string/

    and passing in the string to but the third party provider is rejecting the returned string.

    Is this returning 32 long hexadecimal? I tried playing with the ToString and swapping x2/X2 etc but no luck?

    Wednesday, February 27, 2019 4:03 PM

All replies

  • Hello,

    where i need to send an MD5 algorithm
    In .Net you didn't have an option to send any kind of ALGORITHM anywhere.
    There are no option to transfer a byte-code to another system and make it work.

    > but the third party provider is rejecting the returned string.
    I would guess - it's an australian or south-american native provider. Yes, they rarely speak foreign languages.

    > Is this returning 32 long hexadecimal?
    Yes, in reference you provide it is 32 digits long hexadecimal string. MD5 hash always is 16 bytes long. 
    And - NO, you can't convert it to Long Integer (64 bits) value - it is twice bigger - 128 bits. Always this size.

    > I tried playing with the ToString and swapping x2/X2 etc but no luck?Make a simple 16 bytes long array, fill with data and convert to hexadecimal string.
    Details about format specification: 

     https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings


    Sincerely, Highly skilled coding monkey.

    Wednesday, February 27, 2019 4:38 PM
  • Ok.... Sorry let me rephrase that when i say "i need to send an MD5 algorithm" i mean that i am sending a this info by another mean so i would need to generate this before sending.

    So are you saying the link posted above is not applicable to my problem and that there's another way around this problem?

    I would like to convert a string to MD5 Hex 32 - if that makes sense?

    Edit, so i THINK what i need is to generate 9e107d9d372bb6826bd81d3542a419d6 if the string is The quick brown fox jumps over the lazy dog. I came to this conclusion by entering that text into http://www.md5hasher.net/
    • Edited by Pure Deal Wednesday, February 27, 2019 5:04 PM
    Wednesday, February 27, 2019 4:59 PM
  • Information on the provided link are correct - method will return 32 digits long hexadecimal string.

    If you not sure about format try this

    ((byte)'G').ToString("X2")
    "47"

     

    Sincerely, Highly skilled coding monkey.

    Wednesday, February 27, 2019 5:07 PM