FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WEBDEV 2024
→
PHP - SHA1 Issue
PHP - SHA1 Issue
Débuté par Mark, 25 juil. 2017 13:34 - 1 réponse
Connectez-vous…
Mark
#1
Posté le 25 juillet 2017 - 13:34
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
Signaler
0
0
Fabrice Harari
#2
Posté le 25 juillet 2017 - 14:20
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
Signaler
0
0
→ Revenir à WEBDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte