FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WEBDEV 2024
→
PHP - SHA1 Issue
PHP - SHA1 Issue
Iniciado por Mark, 25,jul. 2017 13:34 - 1 respuesta
Conéctese…
Mark
#1
Publicado el 25,julio 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
Informar
0
0
Fabrice Harari
#2
Publicado el 25,julio 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
Informar
0
0
→ Volver a WEBDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto