PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WEBDEV 2024
→
PHP - SHA1 Issue
PHP - SHA1 Issue
Started by Mark, Jul., 25 2017 1:34 PM - 1 reply
Connect yourself…
Mark
#1
Posted on July, 25 2017 - 1:34 PM
We're working on moving an existing site over from PHP/MySQL to AWP. We are having an issue with existing passwords which were encrypted using SHA1. The 60 character hex string in the password fields do not match what we're getting when we run the HashString function in the function below:
PROCEDURE SHA1HashStringToHex(LOCAL psStringToHash is string)
LOCAL
lbufHashed is Buffer
lcChar is character = ""
liPos is int = 0
liLen is int = 0
lsHexResult is string = ""
lbufHashed = HashString(HA_SHA_160, NoSpace(psStringToHash))
liLen = Length(lbufHashed)
FOR liPos = 1 TO liLen
lcChar = lbufHashed[[liPos]]
lsHexResult += NumToString(Asc(lcChar),"1x")
END
RESULT = lsHexResult
Thanks,
Mark
Report
0
0
Fabrice Harari
#2
Posted on July, 25 2017 - 2:20 PM
Hi Mark,
"1x"?
A character value goes from 0 to 255, so you should probably use 2x
instead, as the 1 gives you only ONE hex character in output.
or simply use buffertohexa instead of your loop
Best regards
--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting
Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)
More information on
http://www.fabriceharari.com
Le 7/25/2017 à 5:34 AM, Mark a écrit :
We're working on moving an existing site over from PHP/MySQL to AWP. We
are having an issue with existing passwords which were encrypted using
SHA1. The 60 character hex string in the password fields do not match
what we're getting when we run the HashString function in the function
below:
PROCEDURE SHA1HashStringToHex(LOCAL psStringToHash is string)
LOCAL
lbufHashed is Buffer lcChar is character = ""
liPos is int = 0
liLen is int = 0
lsHexResult is string = ""
lbufHashed = HashString(HA_SHA_160, NoSpace(psStringToHash))
liLen = Length(lbufHashed)
FOR liPos = 1 TO liLen lcChar = lbufHashed[[liPos]]
lsHexResult += NumToString(Asc(lcChar),"1x")
END
RESULT = lsHexResult
Thanks,
Mark
Report
0
0
→ Go back to WEBDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text