PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → MD5 Hash
MD5 Hash
Iniciado por Carlos Antunez, 23,ago. 2014 22:11 - 8 respuestas
Publicado el 23,agosto 2014 - 22:11
Hi and thanks in advanced for the help.

Just got my Licenses of WebDev, WinDev, and Win Mobile

I am totally new to the Wlanguage and not familiar to WebDev, so I would appreciate your help and most important your patience.

This is what I got.

I created a desktop application with another platform in which uses MD5 to encrypt my User Table created in MS SQL. the encryption works well for my old desktop application when the user enters his\hers password as an example, the password then gets encrypted into this 27cd643e440b71a19c8d18c28ebc269a encrypted value.

Now, in my new login application developed with WebDev the user enters his/hers User Id and password however, it does not encrypts the password field as my old desktop application do which is using MD5 as well

Here is the code I have

//EDT_Employee_id is a non linked string field on my Screen.
//qryUser_Empl_Id is a query with a parameter pUser_Id.
//USER is the name of my data file
//WIN_MAIN_WINDOW is the name of my Window.

IF EDT_Employee_id<>""THEN
qryUser_Empl_Id.pUser_Id=EDT_Employee_id
// Calculate the Hash of the values for two edit controls
HReadSeekFirst(USERS,USER_ID,EDT_Employee_id)
FileToScreen(WIN_MAIN_WINDOW,EXPRESS_USERS)


IF HFound(USERS) =True THEN


Hash1 is Buffer = HashString(HA_MD5_128,StringToUTF8(EDT_Login_Password))
Hash2 isstring = USERS.USER_PASSWORD//The Value is the one mentioned above //7cd643e440b71a19c8d18c28ebc269a

Info(Hash1)//Pop an Info message to get the value from the hash

// Compare the two Hashes
IFHash1 = Hash2THEN
Info("The two strings are identical.")
ELSE
Info("Not the same.")
END
ELSE
Info("not found")
END

END


Hope you can help me out in finding out why the result of Hash1 is not the same as Hash2.

Thank you so much one more time.

Best regards
Miembro registrado
49 mensajes
Publicado el 25,agosto 2014 - 09:32
Hi again Carlos !

I created some web applications with logins, and I have the same problem. Finding information for encrypt like MD5, I found nothing, so I got adapted to Webdev encryption, that isn't bad... My code:

Crypt(PASSWORD,"",cryptAnsi+compressNone)
Publicado el 26,agosto 2014 - 01:52
Hi Rafaved.

Thanks for your help.

I kind of refuse to believe that with all the functions like MD5 in WebDev they don't work. One of the reasons I purchased the product was the "Supposedly easy way to use the MD5" Function, and I was assured by PCSoft that the MD5 function works. I have tried the impossible and still doesn't work. I sent an email to tech support and no response from them. I hope that they respond back with a solution. I hope that I didn't get robbed here hope not. I also hope that there is someone who had tried this solution and found the way to get it to work. I need to have my desktop and the application which I am building with WebDev synchronized using MD5.

Thanks

Carlos
Miembro registrado
49 mensajes
Publicado el 26,agosto 2014 - 11:33
If PCSOFT says that MD5 is posible in Webdev, it must be true, but I don't know how to do that. Please Carlos, share the solution if you discover something.

Rafadev
Publicado el 26,agosto 2014 - 13:17
Hi

What you are talking about is not en encryption, it is a HASH... the
difference is that an encryption can be reverted (decrypted) while a
hash is like a very complex CRC, a ONE WAY function...

As such, it is available in wlanguage with the HashString function

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXShowroom.com is available: Show your projects!
More information on http://www.fabriceharari.com


On 8/26/2014 3:33 AM, rafadev wrote:
If PCSOFT says that MD5 is posible in Webdev, it must be true, but I
don't know how to do that. Please Carlos, share the solution if you
discover something.

Rafadev
Miembro registrado
49 mensajes
Publicado el 26,agosto 2014 - 18:23
Fabrice, please can you show us how to do a hash of a string in MD5?
Publicado el 27,agosto 2014 - 12:24
Hi

I'm not sure what more than this I can do:
http://help.windev.com/en-US/…

the example at the beginning of the page is using the MD5 mode, as
clearly shown by the constant/option name.

Then you WILL HAVE TO read the remaining of the page to see if in your
specific case you need to use antoher option (HMAC or not)

By the way, as it seems that you couldn't find how to do this, the help
system (both online an in the product) come with a SEARCH function...
Searching for "MD5" in it points to several pages, including the
HashString function linked above.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXShowroom.com is available: Show your projects!
More information on http://www.fabriceharari.com


On 8/26/2014 10:23 AM, rafadev wrote:
> Fabrice, please can you show us how to do a hash of a string in MD5?
Miembro registrado
49 mensajes
Publicado el 27,agosto 2014 - 12:35
Got it

cHexa is string = ""
i is int
cHash is string = HashString(HA_MD5_128,"key")
FOR i = 1 TO Length(cHash)
cHexa += NumToString(Asc(cHash[[i]]),"02X")
END
Info(cHexa)
Publicado el 01,septiembre 2014 - 15:57
Hi Rafadev and all that tried to help me.

My apologies on this late reply to my own question and to all of you guys who helped on this topic, however I had a family issue which I had to resolve.

Rafadev.

Thanks for all your help, the sample code you posted is the answera nd worked as expected.

Thank you so much.

Best regards

Carlos